mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 01:36:24 +01:00
htlcswitch: add quit case to initial channel state sync select in channelLink
In this commit we add a quit case to the select statement that’s entered once a link is created. Before this commit, upon restart it would be possible that the deamon would never ben able to shutdown as the link would be waiting for the messages to be sent by the other side.
This commit is contained in:
parent
6f51b941df
commit
632f230fef
1 changed files with 6 additions and 3 deletions
|
@ -297,7 +297,10 @@ func (l *channelLink) Stop() {
|
|||
//
|
||||
// NOTE: This MUST be run as a goroutine.
|
||||
func (l *channelLink) htlcManager() {
|
||||
defer l.wg.Done()
|
||||
defer func() {
|
||||
l.wg.Done()
|
||||
log.Infof("ChannelLink(%v) has exited", l)
|
||||
}()
|
||||
|
||||
log.Infof("HTLC manager for ChannelPoint(%v) started, "+
|
||||
"bandwidth=%v", l.channel.ChannelPoint(), l.Bandwidth())
|
||||
|
@ -367,6 +370,8 @@ func (l *channelLink) htlcManager() {
|
|||
// In any case, we'll then process their ChanSync
|
||||
// message.
|
||||
l.handleUpstreamMsg(msg)
|
||||
case <-l.quit:
|
||||
return
|
||||
case <-chanSyncDeadline:
|
||||
l.fail("didn't receive ChannelReestablish before " +
|
||||
"deadline")
|
||||
|
@ -534,8 +539,6 @@ out:
|
|||
break out
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("ChannelLink(%v) has exited", l)
|
||||
}
|
||||
|
||||
// handleDownStreamPkt processes an HTLC packet sent from the downstream HTLC
|
||||
|
|
Loading…
Add table
Reference in a new issue