Resolving a racing condition while adding ports on the app's side.
An earlier attempt (ad6265786871) to resolve this condition on the router's side added a new issue: the app could get a request before acquiring a port.
This commit is contained in:
@@ -50,7 +50,11 @@ func add_port(p *port) {
|
||||
port_registry_.m = make(map[port_key]*port)
|
||||
}
|
||||
|
||||
port_registry_.m[p.key] = p
|
||||
old := port_registry_.m[p.key]
|
||||
|
||||
if old == nil {
|
||||
port_registry_.m[p.key] = p
|
||||
}
|
||||
|
||||
port_registry_.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user