File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -867,8 +867,17 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
867
867
}
868
868
}
869
869
870
- // Dispatch the commitment update message to the proper active
871
- // goroutine dedicated to this channel.
870
+ // In order to avoid unnecessarily delivering message
871
+ // as the peer is exiting, we'll check quickly to see
872
+ // if we need to exit.
873
+ select {
874
+ case <- p .quit :
875
+ return
876
+ default :
877
+ }
878
+
879
+ // Dispatch the commitment update message to the proper
880
+ // active goroutine dedicated to this channel.
872
881
if chanLink == nil {
873
882
link , err := p .server .htlcSwitch .GetLink (cid )
874
883
if err != nil {
@@ -879,6 +888,15 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
879
888
chanLink = link
880
889
}
881
890
891
+ // In order to avoid unnecessarily delivering message
892
+ // as the peer is exiting, we'll check quickly to see
893
+ // if we need to exit.
894
+ select {
895
+ case <- p .quit :
896
+ return
897
+ default :
898
+ }
899
+
882
900
chanLink .HandleChannelUpdate (msg )
883
901
},
884
902
)
You can’t perform that action at this time.
0 commit comments