From 7b2460662d6c4dc4ebf12940e29bff43b8ef4106 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Tue, 22 Jan 2019 21:53:39 -0600 Subject: [PATCH] close the connection before blocking a duplicate link --- src/yggdrasil/link.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/link.go b/src/yggdrasil/link.go index 660c854a..1899582a 100644 --- a/src/yggdrasil/link.go +++ b/src/yggdrasil/link.go @@ -107,8 +107,9 @@ func (intf *linkInterface) handler() error { if oldIntf, isIn := intf.link.interfaces[intf.info]; isIn { intf.link.mutex.Unlock() // FIXME we should really return an error and let the caller block instead - // That lets them do things like close connections before blocking + // That lets them do things like close connections on its own, avoid printing a connection message in the first place, etc. intf.link.core.log.Println("DEBUG: found existing interface for", intf.name) + intf.msgIO.close() <-oldIntf.closed return nil } else {