From 0fef1c71fe89e9d94558084c16d401e88d60cd4f Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 30 Jul 2018 13:11:11 -0700 Subject: [PATCH] htlcswitch/link: pass link quit to ForwardPackets --- htlcswitch/link.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 2ba04f556..3112b8ed1 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -117,9 +117,10 @@ type ChannelLinkConfig struct { Switch *Switch // ForwardPackets attempts to forward the batch of htlcs through the - // switch. Any failed packets will be returned to the provided - // ChannelLink. - ForwardPackets func(...*htlcPacket) chan error + // switch, any failed packets will be returned to the provided + // ChannelLink. The link's quit signal should be provided to allow + // cancellation of forwarding during link shutdown. + ForwardPackets func(chan struct{}, ...*htlcPacket) chan error // DecodeHopIterators facilitates batched decoding of HTLC Sphinx onion // blobs, which are then used to inform how to forward an HTLC. @@ -2542,7 +2543,7 @@ func (l *channelLink) forwardBatch(packets ...*htlcPacket) { filteredPkts = append(filteredPkts, pkt) } - errChan := l.cfg.ForwardPackets(filteredPkts...) + errChan := l.cfg.ForwardPackets(l.quit, filteredPkts...) go l.handleBatchFwdErrs(errChan) }