routing: close exit chan before ntfnChan to cancel topology clients
This commit fixes a panic due to a send on a closed channel that could possibly occur depending on the order of channel closes when a client goes to cancel a topology notification client. Previously we closed the ntfnChan first, this would possible result in a panic as the goroutine may have succeeded on a send at the same time the channel was closed. Instead, we now close the `exit` channel first which is meant to be a signal to the goroutine that the client has been canceled.
This commit is contained in:
parent
bfc869739d
commit
a4ba72c08c
@ -489,8 +489,8 @@ func (r *ChannelRouter) networkHandler() {
|
||||
if ntfnUpdate.cancel {
|
||||
if client, ok := r.topologyClients[ntfnUpdate.clientID]; ok {
|
||||
delete(r.topologyClients, clientID)
|
||||
close(client.ntfnChan)
|
||||
close(client.exit)
|
||||
close(client.ntfnChan)
|
||||
}
|
||||
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user