ENGINE-187 added remaining time return when timeout interrupted by message - untested, not even built ENGINE-187
authorEdouard Tisserant <edouard@pep-project.org>
Thu, 20 Apr 2017 16:40:42 +0200
branchENGINE-187
changeset 2448c258e7d10f4
parent 243 8d880a56f9f7
child 245 ffcbcf8934a1
ENGINE-187 added remaining time return when timeout interrupted by message - untested, not even built
CpEpEngine.cpp
     1.1 --- a/CpEpEngine.cpp	Tue Apr 18 21:25:41 2017 +0200
     1.2 +++ b/CpEpEngine.cpp	Thu Apr 20 16:40:42 2017 +0200
     1.3 @@ -1277,6 +1277,19 @@
     1.4              {
     1.5                  *timeout = 1; // Signal timeout
     1.6                  return NULL;
     1.7 +            } 
     1.8 +            else 
     1.9 +            {
    1.10 +                auto now = std::chrono::steady_clock::now()
    1.11 +                if (now < end_time) 
    1.12 +                {
    1.13 +                    std::chrono::duration<time_t> remaining_seconds = end_time - now;
    1.14 +                    *timeout = remaining_seconds.count();
    1.15 +                } 
    1.16 +                else 
    1.17 +                {
    1.18 +                    *timeout = 0;
    1.19 +                }
    1.20              }
    1.21          }
    1.22      }
    1.23 @@ -1598,4 +1611,4 @@
    1.24      // notify the keysync thread.
    1.25      self->notify_handshake_finished = true;
    1.26      self->keysync_condition.notify_all();
    1.27 -}
    1.28 \ No newline at end of file
    1.29 +}