Commit 900c1fbf authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

net/id: when dup id, wait on it.

parent ef0c25f4
......@@ -38,10 +38,11 @@ func NewIDService(n Network) *IDService {
func (ids *IDService) IdentifyConn(c Conn) {
ids.currmu.Lock()
if _, found := ids.currid[c]; found {
if wait, found := ids.currid[c]; found {
ids.currmu.Unlock()
log.Debugf("IdentifyConn called twice on: %s", c)
return // already identifying it.
<-wait // already identifying it. wait for it.
return
}
ids.currid[c] = make(chan struct{})
ids.currmu.Unlock()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment