From: Guus Sliepen Date: Sun, 10 Jul 2011 20:46:43 +0000 (+0200) Subject: Close meta connection socket after cleaning up event structures. X-Git-Tag: release-1.1pre2~18 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=d1cd3c81455ecb32149cbaa424b7870075b2b2fc;p=tinc Close meta connection socket after cleaning up event structures. Epoll doesn't like it when an already closed filedescriptor is being removed, so we defer closing the socket until after all else is cleaned up. --- diff --git a/src/connection.c b/src/connection.c index 956607ca..713a40cb 100644 --- a/src/connection.c +++ b/src/connection.c @@ -87,6 +87,9 @@ void free_connection(connection_t *c) { if(event_initialized(&c->outevent)) event_del(&c->outevent); + if(c->socket > 0) + closesocket(c->socket); + free(c); } diff --git a/src/net.c b/src/net.c index 7ce4f318..8df87d6e 100644 --- a/src/net.c +++ b/src/net.c @@ -116,9 +116,6 @@ void terminate_connection(connection_t *c, bool report) { if(c->node) c->node->connection = NULL; - if(c->socket) - closesocket(c->socket); - if(c->edge) { if(report && !tunnelserver) send_del_edge(broadcast, c->edge);