X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=2565be113506502626af2c65ff49c7cb8cf7b61c;hb=a96c4f016c9fff2392d85f762e16f5430c0b6463;hp=10a2d20645951081fef4c68e70fdf4e97f8df111;hpb=40c28589328a2aa96c2ce1419c5d90616c758b3d;p=tinc diff --git a/src/net.c b/src/net.c index 10a2d206..2565be11 100644 --- a/src/net.c +++ b/src/net.c @@ -1,7 +1,7 @@ /* net.c -- most of the network code Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2011 Guus Sliepen + 2000-2012 Guus Sliepen 2006 Scott Lamb 2011 Loïc Grenié @@ -121,6 +121,7 @@ void terminate_connection(connection_t *c, bool report) { send_del_edge(everyone, c->edge); edge_del(c->edge); + c->edge = NULL; /* Run MST and SSSP algorithms */ @@ -139,12 +140,13 @@ void terminate_connection(connection_t *c, bool report) { } } - /* Check if this was our outgoing connection */ + free_connection_partially(c); - if(c->outgoing) - retry_outgoing(c->outgoing); + /* Check if this was our outgoing connection */ - connection_del(c); + if(c->outgoing) { + do_outgoing_connection(c); + } } /* @@ -171,7 +173,7 @@ static void timeout_handler(int fd, short events, void *event) { 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, now - c->last_ping_time); + c->name, c->hostname, (long)now - c->last_ping_time); terminate_connection(c, true); continue; } else if(c->last_ping_time + pinginterval <= now) {