X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_auth.c;h=18fbb64af0438eac8deb38fc16187272bec26083;hb=29fbce4497357580fc0aa00f087e8f1a538a2a50;hp=70ccda178b983cfd1a3788d46c06253ac867bb1b;hpb=fb0cfccf7dc2240b576011edcf74fd5b058916cb;p=tinc diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 70ccda17..18fbb64a 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -540,8 +540,17 @@ bool ack_h(connection_t *c) { } else { if(n->connection) { /* Oh dear, we already have a connection to this node. */ - ifdebug(CONNECTIONS) logger(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), - n->name, n->hostname); + ifdebug(CONNECTIONS) logger(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"), n->connection->name, n->connection->hostname); + + if(n->connection->outgoing) { + if(c->outgoing) + logger(LOG_WARNING, _("Two outgoing connections to the same node!")); + else + c->outgoing = n->connection->outgoing; + + n->connection->outgoing = NULL; + } + terminate_connection(n->connection, false); /* Run graph algorithm to purge key and make sure up/down scripts are rerun with new IP addresses and stuff */ graph();