X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=06351bfcc42890381fb98bd2ad4eee25cb4198cd;hp=e5ffc4f528bcba92daaad1aa538e0dc283f2c730;hb=013bd456084337974aa0b7f2af49e3d9d1afc74c;hpb=7df18f17d159a5f410ff2f1395198a3496a80fd4 diff --git a/src/net.c b/src/net.c index e5ffc4f5..06351bfc 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-2012 Guus Sliepen + 2000-2015 Guus Sliepen 2006 Scott Lamb 2011 Loïc Grenié @@ -182,6 +182,12 @@ void terminate_connection(connection_t *c, bool report) { closesocket(c->socket); if(c->edge) { + if(!c->node) { + logger(LOG_ERR, "Connection to %s (%s) has an edge but node is NULL!", c->name, c->hostname); + // And that should never happen. + abort(); + } + if(report && !tunnelserver) send_del_edge(everyone, c->edge); @@ -212,6 +218,12 @@ void terminate_connection(connection_t *c, bool report) { c->status.remove = false; do_outgoing_connection(c); } + +#ifndef HAVE_MINGW + /* Clean up dead proxy processes */ + + while(waitpid(-1, NULL, WNOHANG) > 0); +#endif } /* @@ -490,7 +502,8 @@ int main_loop(void) { expire_events(); for(node = connection_tree->head; node; node = node->next) { connection_t *c = node->data; - send_ping(c); + if(c->status.active) + send_ping(c); } sigalrm = false; }