]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add update_current_time() calls to periodic and event-driven callbacks
authorNick Mathewson <nickm@torproject.org>
Thu, 3 May 2018 14:56:49 +0000 (10:56 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 3 May 2018 16:02:10 +0000 (12:02 -0400)
This is part of 26009, where we're going to keep track of the
current time and its jumps without having to do so in
second_elapsed_callback.

src/or/connection.c
src/or/main.c
src/or/periodic.c

index c2673ade1647d75ba067bb19ca20bb7a49ecb0ec..df36d4211637693d9d42302871346e2c5434ac83 100644 (file)
@@ -3439,7 +3439,7 @@ int
 connection_handle_read(connection_t *conn)
 {
   int res;
-
+  update_current_time(time(NULL));
   res = connection_handle_read_impl(conn);
   return res;
 }
@@ -3982,6 +3982,7 @@ int
 connection_handle_write(connection_t *conn, int force)
 {
     int res;
+    update_current_time(time(NULL));
     conn->in_connection_handle_write = 1;
     res = connection_handle_write_impl(conn, force);
     conn->in_connection_handle_write = 0;
index 6ecc340a918ed019912abdd2e942a9c492f65b4e..d773c8e29bf79639417bf11e8bc6856e5debfac2 100644 (file)
@@ -3047,6 +3047,7 @@ signal_callback(evutil_socket_t fd, short events, void *arg)
   (void)fd;
   (void)events;
 
+  update_current_time(time(NULL));
   process_signal(sig);
 }
 
index 76aa418b358fdf4c5ba5aec41b82ebc5b4cb6c11..92fa677f8fb23b3f766aa843cb9ed86b3ac3d0a1 100644 (file)
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "compat_libevent.h"
 #include "config.h"
+#include "main.h"
 #include "periodic.h"
 
 /** We disable any interval greater than this number of seconds, on the
@@ -48,6 +49,7 @@ periodic_event_dispatch(mainloop_event_t *ev, void *data)
   }
 
   time_t now = time(NULL);
+  update_current_time(now);
   const or_options_t *options = get_options();
 //  log_debug(LD_GENERAL, "Dispatching %s", event->name);
   int r = event->fn(now, options);