merged
authorEdouard Tisserant <edouard@pep-project.org>
Fri, 21 Apr 2017 17:11:50 +0200
changeset 248e55fc51ec0f9
parent 243 8d880a56f9f7
parent 246 3b4c910af3be
child 249 2ac6226ff198
child 251 ded328cde93f
child 255 612df53e077a
merged
     1.1 --- a/CpEpEngine.cpp	Tue Apr 18 21:25:41 2017 +0200
     1.2 +++ b/CpEpEngine.cpp	Fri Apr 21 17:11:50 2017 +0200
     1.3 @@ -1263,7 +1263,7 @@
     1.4          me->notify_handshake_deliver_result();
     1.5  
     1.6      if (timeout && *timeout) {
     1.7 -        auto end_time = std::chrono::steady_clock::now()
     1.8 +        std::chrono::steady_clock::time_point end_time = std::chrono::steady_clock::now()
     1.9              + std::chrono::seconds(*timeout);
    1.10  
    1.11          while (me->keysync_queue.empty() && !me->keysync_abort_requested)
    1.12 @@ -1277,6 +1277,19 @@
    1.13              {
    1.14                  *timeout = 1; // Signal timeout
    1.15                  return NULL;
    1.16 +            } 
    1.17 +            else 
    1.18 +            {
    1.19 +                std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
    1.20 +
    1.21 +                if (now < end_time) 
    1.22 +                {
    1.23 +                    *timeout = std::chrono::duration_cast<std::chrono::seconds>(end_time - now).count();
    1.24 +                } 
    1.25 +                else 
    1.26 +                {
    1.27 +                    *timeout = 0;
    1.28 +                }
    1.29              }
    1.30          }
    1.31      }
    1.32 @@ -1598,4 +1611,4 @@
    1.33      // notify the keysync thread.
    1.34      self->notify_handshake_finished = true;
    1.35      self->keysync_condition.notify_all();
    1.36 -}
    1.37 \ No newline at end of file
    1.38 +}