X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet.c;h=deac6eee42a612a57ef3e621a0eb657f0b924913;hb=7593adb9ad9e6ff73afe29e9bd445cea8615a151;hp=1fe333426babcc042917160a15c7bfd8621cf375;hpb=3268e9a2b9fea6779224fe1f3da48b7fc4b9cb46;p=meshlink diff --git a/src/net.c b/src/net.c index 1fe33342..deac6eee 100644 --- a/src/net.c +++ b/src/net.c @@ -48,14 +48,14 @@ void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report) if(c->edge) { if(report) - send_del_edge(mesh->everyone, c->edge); + send_del_edge(mesh, mesh->everyone, c->edge); - edge_del(c->edge); + edge_del(mesh, c->edge); c->edge = NULL; /* Run MST and SSSP algorithms */ - graph(); + graph(mesh); /* If the node is not reachable anymore but we remember it had an edge to us, clean it up */ @@ -63,14 +63,14 @@ void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report) edge_t *e; e = lookup_edge(c->node, mesh->self); if(e) { - send_del_edge(mesh->everyone, e); - edge_del(e); + send_del_edge(mesh, mesh->everyone, e); + edge_del(mesh, e); } } } outgoing_t *outgoing = c->outgoing; - connection_del(c); + connection_del(mesh, c); /* Check if this was our outgoing connection */ @@ -101,7 +101,7 @@ static void timeout_handler(event_loop_t *loop, void *data) { if(c->status.pinged) { 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); + send_ping(mesh, c); continue; } else { continue; @@ -178,6 +178,8 @@ static void periodic_handler(event_loop_t *loop, void *data) { } if(!found) { + //TODO: if the node is blacklisted the connection will not happen, but + //the user will read this debug message "Autoconnecting to %s" that is misleading logger(DEBUG_CONNECTIONS, LOG_INFO, "Autoconnecting to %s", n->name); outgoing_t *outgoing = xzalloc(sizeof *outgoing); outgoing->name = xstrdup(n->name); @@ -236,7 +238,7 @@ static void periodic_handler(event_loop_t *loop, void *data) { } void handle_meta_connection_data(meshlink_handle_t *mesh, connection_t *c) { - if (!receive_meta(c)) { + if (!receive_meta(mesh, c)) { terminate_connection(mesh, c, c->status.active); return; }