5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 21:10:29 +00:00

close the connection before blocking a duplicate link

This commit is contained in:
Arceliar 2019-01-22 21:53:39 -06:00
parent f936151f2d
commit 7b2460662d

View File

@ -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 {