mirror of https://github.com/status-im/go-waku.git
fix: noise protocol channel close race condition
This commit is contained in:
parent
42b2c0bc6d
commit
884f65ecdf
|
@ -95,6 +95,7 @@ func (r *NoiseWakuRelay) Subscribe(ctx context.Context, contentTopic string) <-c
|
|||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
close(sub.msgChan)
|
||||
return
|
||||
case env := <-sub.broadcastSub.Ch:
|
||||
if env == nil {
|
||||
|
@ -137,7 +138,6 @@ func (r *NoiseWakuRelay) Stop() {
|
|||
for _, contentTopicSubscriptions := range r.subscriptionChPerContentTopic {
|
||||
for _, c := range contentTopicSubscriptions {
|
||||
c.broadcastSub.Unsubscribe()
|
||||
close(c.msgChan)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue