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 { if oldIntf, isIn := intf.link.interfaces[intf.info]; isIn {
intf.link.mutex.Unlock() intf.link.mutex.Unlock()
// FIXME we should really return an error and let the caller block instead // 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.link.core.log.Println("DEBUG: found existing interface for", intf.name)
intf.msgIO.close()
<-oldIntf.closed <-oldIntf.closed
return nil return nil
} else { } else {