5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 04:51:38 +00:00

make dial fail if a session to the same node already exists, fixes race between simultaneous connections to a node's 200 address and one of its 300 addresses, should also fix races between a search and an accepted listen

This commit is contained in:
Arceliar 2019-09-01 14:07:00 -05:00
parent 730fd08954
commit 8c52ccadf9

View File

@ -204,6 +204,11 @@ func (sinfo *searchInfo) checkDHTRes(res *dhtRes) bool {
if !isIn {
panic("This should never happen")
}
} else {
sinfo.callback(nil, errors.New("session already exists"))
// Cleanup
delete(sinfo.searches.searches, res.Dest)
return true
}
// FIXME (!) replay attacks could mess with coords? Give it a handle (tstamp)?
sess.coords = res.Coords