]> git.meshlink.io Git - meshlink/blobdiff - src/net.c
Remove global variable "now".
[meshlink] / src / net.c
index 12f2f33d7c48e921ced4558ef77b3e423dd5dee9..878a2f99b5e0de984d34762bb0775db0650ec18d 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -124,11 +124,11 @@ void terminate_connection(connection_t *c, bool report) {
 */
 static void timeout_handler(event_loop_t *loop, void *data) {
        for list_each(connection_t, c, mesh->connections) {
-               if(c->last_ping_time + mesh->pingtimeout <= now.tv_sec) {
+               if(c->last_ping_time + mesh->pingtimeout <= mesh->loop.now.tv_sec) {
                        if(c->status.active) {
                                if(c->status.pinged) {
-                                       logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)now.tv_sec - c->last_ping_time);
-                               } else if(c->last_ping_time + mesh->pinginterval <= now.tv_sec) {
+                                       logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)mesh->loop.now.tv_sec - c->last_ping_time);
+                               } else if(c->last_ping_time + mesh->pinginterval <= mesh->loop.now.tv_sec) {
                                        send_ping(c);
                                        continue;
                                } else {
@@ -303,7 +303,7 @@ int reload_configuration(void) {
                }
        }
 
-       mesh->last_config_check = now.tv_sec;
+       mesh->last_config_check = mesh->loop.now.tv_sec;
 
        return 0;
 }