X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconnection.c;h=2f35124e20ccef6a604493aa39b0e59e17f8e1d4;hb=743d3cefc244e669c9265da8355e8722d990fc8e;hp=92a9f48ef0517e53ae52c38f9935adb3392a58fd;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/connection.c b/src/connection.c index 92a9f48e..2f35124e 100644 --- a/src/connection.c +++ b/src/connection.c @@ -27,6 +27,7 @@ #include "control_common.h" #include "list.h" #include "logger.h" +#include "net.h" #include "rsa.h" #include "subnet.h" #include "utils.h" @@ -44,7 +45,10 @@ void init_connections(void) { void exit_connections(void) { list_delete_list(connection_list); + connection_list = NULL; + free_connection(everyone); + everyone = NULL; } connection_t *new_connection(void) { @@ -68,6 +72,7 @@ void free_connection(connection_t *c) { ecdsa_free(c->ecdsa); free(c->hischallenge); + free(c->mychallenge); buffer_clear(&c->inbuf); buffer_clear(&c->outbuf); @@ -75,7 +80,11 @@ void free_connection(connection_t *c) { io_del(&c->io); if(c->socket > 0) { - closesocket(c->socket); + if(c->status.tarpit) { + tarpit(c->socket); + } else { + closesocket(c->socket); + } } free(c->name);