]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Be more selective about when to replenish connection requests
authorMatt Joiner <anacrolix@gmail.com>
Wed, 21 May 2014 07:49:59 +0000 (17:49 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 21 May 2014 07:49:59 +0000 (17:49 +1000)
client.go

index e697884e81a192c5c2f5ec0fc358948743abb7e4..bce8eab23fa086e933ae2650cdbf504076d3c851 100644 (file)
--- a/client.go
+++ b/client.go
@@ -395,6 +395,7 @@ func (me *Client) connectionLoop(torrent *torrent, conn *connection) error {
                case peer_protocol.Unchoke:
                        conn.PeerChoked = false
                        me.peerUnchoked(torrent, conn)
+                       me.replenishConnRequests(torrent, conn)
                case peer_protocol.Interested:
                        conn.PeerInterested = true
                        // TODO: This should be done from a dedicated unchoking routine.
@@ -453,7 +454,6 @@ func (me *Client) connectionLoop(torrent *torrent, conn *connection) error {
                if err != nil {
                        return err
                }
-               me.replenishConnRequests(torrent, conn)
        }
 }