From b86253c80d6b1aa965f90b46e749184a5d13a52a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 7 Dec 2015 02:39:00 +1100 Subject: [PATCH] Fix #41 --- TODO | 1 + dht/transaction.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 87a397c3..88376218 100644 --- a/TODO +++ b/TODO @@ -7,3 +7,4 @@ * Handle Torrent being dropped before GotInfo. * Track connection chunk contributions to successful and failed piece hashes. Only drop the worst performer on a bad hash. Maybe block its IP. * Remove assumptions that the first piece requested will be the first that peers will send. + * Clean-up DHT transaction code, it's just nasty. diff --git a/dht/transaction.go b/dht/transaction.go index 19825de0..8e3ad0d8 100644 --- a/dht/transaction.go +++ b/dht/transaction.go @@ -36,7 +36,12 @@ func (t *Transaction) tryHandleResponse() { return } select { - case r := <-t.response: + case r, ok := <-t.response: + if !ok { + // TODO: I think some assumption is broken. This isn't supposed to + // happen. + break + } t.userOnResponse(r) // Shouldn't be called more than once. t.userOnResponse = nil -- 2.48.1