Correct calculation of restart timeout, and up timeout to 200ms.
authorDavin McCall <davmac@davmac.org>
Fri, 2 Jun 2017 17:49:13 +0000 (18:49 +0100)
committerDavin McCall <davmac@davmac.org>
Fri, 2 Jun 2017 17:49:13 +0000 (18:49 +0100)
src/service.cc

index 08145e203983223a1553e61891884fa86ef13a27..69e8cbc5447f8649cdfa511b080fd6c68b114dfa 100644 (file)
@@ -1191,14 +1191,14 @@ void base_process_service::restart_ps_process() noexcept
         tdiff_ns = 1000000000 - (last_start_time.tv_nsec - current_time.tv_nsec);
     }
 
-    if (tdiff_s > 0 || tdiff_ns > 100000000) {
-        // > 100ms
+    if (tdiff_s > 0 || tdiff_ns > 200000000) {
+        // > 200ms
         start_ps_process();
     }
     else {
         timespec timeout;
-        timeout.tv_sec = tdiff_s;
-        timeout.tv_nsec = tdiff_ns;
+        timeout.tv_sec = 0;
+        timeout.tv_nsec = 200000000 - tdiff_ns;
         restart_timer.arm_timer_rel(eventLoop, timeout);
     }
 }