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);