lnwallet: ensure sigPool goroutines can always exit

This commit is contained in:
Olaoluwa Osuntokun 2017-11-11 14:59:49 -08:00
parent 8c181b6f4e
commit 03ba13fcf8
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -191,6 +191,8 @@ func (s *sigPool) poolWorker() {
continue continue
case <-sigMsg.cancel: case <-sigMsg.cancel:
continue continue
case <-s.quit:
return
} }
} }
@ -202,6 +204,8 @@ func (s *sigPool) poolWorker() {
}: }:
case <-sigMsg.cancel: case <-sigMsg.cancel:
continue continue
case <-s.quit:
return
} }
// We've just received a new verification job from the outside // We've just received a new verification job from the outside
@ -226,11 +230,15 @@ func (s *sigPool) poolWorker() {
select { select {
case verifyMsg.errResp <- err: case verifyMsg.errResp <- err:
case <-verifyMsg.cancel: case <-verifyMsg.cancel:
case <-s.quit:
return
} }
} else { } else {
select { select {
case verifyMsg.errResp <- nil: case verifyMsg.errResp <- nil:
case <-verifyMsg.cancel: case <-verifyMsg.cancel:
case <-s.quit:
return
} }
} }