routing: wait for topology clients to fully exit before closing ntfn chan
This commit fixes a send on closed channel panic by adding additional synchronization when cancelling the notifications for a particular topology client. We now ensure that all goroutines belonging to a particular topology client exit fully before we close the notification channel in order to avoid a panic.
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -489,7 +489,10 @@ func (r *ChannelRouter) networkHandler() {
|
||||
if ntfnUpdate.cancel {
|
||||
if client, ok := r.topologyClients[ntfnUpdate.clientID]; ok {
|
||||
delete(r.topologyClients, clientID)
|
||||
|
||||
close(client.exit)
|
||||
client.wg.Wait()
|
||||
|
||||
close(client.ntfnChan)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user