]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Limit pending requests to increase responsiveness
authorMatt Joiner <anacrolix@gmail.com>
Sat, 21 Feb 2015 03:54:15 +0000 (14:54 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 21 Feb 2015 03:54:15 +0000 (14:54 +1100)
download_strategies.go

index 275b57e3fb510d427e219d6667f693cf189b0dfb..f3ef027b73050441f7dd151658807068527e681c 100644 (file)
@@ -40,6 +40,9 @@ func (s *DefaultDownloadStrategy) FillRequests(t *torrent, c *connection) {
                }
        }
        addRequest := func(req request) (again bool) {
+               if len(c.Requests) >= 32 {
+                       return false
+               }
                return c.Request(req)
        }
        for e := c.pieceRequestOrder.First(); e != nil; e = e.Next() {