5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 18:50:27 +00:00

Merge pull request #502 from Arceliar/linkleak

Try to fix leaks in #501
This commit is contained in:
Neil Alexander 2019-08-14 07:17:39 +01:00 committed by GitHub
commit d9fabad8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,10 @@ func (intf *linkInterface) handler() error {
// 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.Debugln("DEBUG: found existing interface for", intf.name)
intf.msgIO.close()
<-oldIntf.closed
if !intf.incoming {
// Block outgoing connection attempts until the existing connection closes
<-oldIntf.closed
}
return nil
} else {
intf.closed = make(chan struct{})