From 19a0eab804cac90f791113f5d5326ec02b29d533 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 25 Jun 2018 11:47:47 -0700 Subject: [PATCH] htlcswitch: in removeLink use new goroutine to stop existing link In this commit, we modify the removeLink method to be more asynchronous. Before this commit, we would attempt to block until the peer exits. However, it may be the case that at times time, then target link is attempting to forward a batch of packets to the switch (forwardBatch). Atm, this method doesn't pass in an external context/quit, so we can't cancel this message/request. As a result, we'll now ensure that `removeLink` doesn't block, so we can resume the switch's main loop as soon as possible. --- htlcswitch/switch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index f7d3b5c8..1d649d73 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -1883,7 +1883,7 @@ func (s *Switch) removeLink(chanID lnwire.ChannelID) error { } } - link.Stop() + go link.Stop() return nil }