mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-08 20:03:10 +01:00
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:
@@ -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