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.
This commit is contained in:
Guus Sliepen 2011-07-10 22:46:43 +02:00
parent 30ef2a981e
commit d1cd3c8145
2 changed files with 3 additions and 3 deletions

View file

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

View file

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