X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=59dd39b30c327b8f15f5deb6360148a043deb466;hp=31970366d8cfc6a69d08be633d64c685ccbf68bd;hb=35af4051c3749cd2c2137a7eb57171a1fbb12af7;hpb=8c267d3d558ac97a4ce7381a37abb6cc4b46b133 diff --git a/src/net.c b/src/net.c index 31970366..59dd39b3 100644 --- a/src/net.c +++ b/src/net.c @@ -431,7 +431,7 @@ int main_loop(void) { if(sighup) { connection_t *c; - avl_node_t *node; + avl_node_t *node, *next; char *fname; struct stat s; @@ -447,6 +447,31 @@ int main_loop(void) { return 1; } + /* Cancel non-active outgoing connections */ + + for(node = connection_tree->head; node; node = next) { + next = node->next; + c = node->data; + + c->outgoing = NULL; + + if(c->status.connecting) { + terminate_connection(c, false); + connection_del(c); + } + } + + /* Wipe list of outgoing connections */ + + for(list_node_t *node = outgoing_list->head; node; node = node->next) { + outgoing_t *outgoing = node->data; + + if(outgoing->event) + event_del(outgoing->event); + } + + list_delete_list(outgoing_list); + /* Close connections to hosts that have a changed or deleted host config file */ for(node = connection_tree->head; node; node = node->next) {