peer: before and after obtaining link for chan update, check quit signal
This commit is contained in:
parent
13a6d413ac
commit
f2db18733b
22
peer.go
22
peer.go
@ -867,8 +867,17 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch the commitment update message to the proper active
|
// In order to avoid unnecessarily delivering message
|
||||||
// goroutine dedicated to this channel.
|
// as the peer is exiting, we'll check quickly to see
|
||||||
|
// if we need to exit.
|
||||||
|
select {
|
||||||
|
case <-p.quit:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispatch the commitment update message to the proper
|
||||||
|
// active goroutine dedicated to this channel.
|
||||||
if chanLink == nil {
|
if chanLink == nil {
|
||||||
link, err := p.server.htlcSwitch.GetLink(cid)
|
link, err := p.server.htlcSwitch.GetLink(cid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -879,6 +888,15 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
|
|||||||
chanLink = link
|
chanLink = link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In order to avoid unnecessarily delivering message
|
||||||
|
// as the peer is exiting, we'll check quickly to see
|
||||||
|
// if we need to exit.
|
||||||
|
select {
|
||||||
|
case <-p.quit:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
chanLink.HandleChannelUpdate(msg)
|
chanLink.HandleChannelUpdate(msg)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user