]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix #41
authorMatt Joiner <anacrolix@gmail.com>
Sun, 6 Dec 2015 15:39:00 +0000 (02:39 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 6 Dec 2015 15:39:00 +0000 (02:39 +1100)
TODO
dht/transaction.go

diff --git a/TODO b/TODO
index 87a397c357d433af16832ed9a28737704cf144d4..88376218f73a31d8f6db90a46c2b0323fb64248e 100644 (file)
--- 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.
index 19825de00a365b1c5c6f6aab04d5dabd955cd8be..8e3ad0d8bf70c09f41b8f50feddd2b4a731a3911 100644 (file)
@@ -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