Merge pull request #1449 from cfromknecht/wait-for-link-shutdown

Wait for link shutdown
This commit is contained in:
Olaoluwa Osuntokun 2018-06-26 19:46:28 -07:00 committed by GitHub
commit 81e647a520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

@ -465,6 +465,12 @@ func (l *channelLink) Stop() {
l.wg.Wait()
}
// WaitForShutdown blocks until the link finishes shutting down, which includes
// termination of all dependent goroutines.
func (l *channelLink) WaitForShutdown() {
l.wg.Wait()
}
// EligibleToForward returns a bool indicating if the channel is able to
// actively accept requests to forward HTLC's. We're able to forward HTLC's if
// we know the remote party's next revocation point. Otherwise, we can't

@ -3710,6 +3710,7 @@ func (h *persistentLinkHarness) restart(restartSwitch bool,
// First, remove the link from the switch.
h.coreLink.cfg.Switch.RemoveLink(h.link.ChanID())
h.coreLink.WaitForShutdown()
var htlcSwitch *Switch
if restartSwitch {