From: Matt Joiner Date: Sun, 6 Dec 2015 15:39:00 +0000 (+1100) Subject: Fix #41 X-Git-Tag: v1.0.0~978 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=b86253c80d6b1aa965f90b46e749184a5d13a52a;p=btrtrc.git Fix #41 --- 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