TODO | 1 + dht/transaction.go | 7 ++++++- diff --git a/TODO b/TODO index 87a397c357d433af16832ed9a28737704cf144d4..88376218f73a31d8f6db90a46c2b0323fb64248e 100644 --- a/TODO +++ b/TODO @@ -7,3 +7,4 @@ * UL/DL rate-limiting. * 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 19825de00a365b1c5c6f6aab04d5dabd955cd8be..8e3ad0d8bf70c09f41b8f50feddd2b4a731a3911 100644 --- a/dht/transaction.go +++ b/dht/transaction.go @@ -36,7 +36,12 @@ if t.userOnResponse == nil { 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