A CPU optimization to FillRequests when we know no more can be added
This commit is contained in:
parent
b969b17092
commit
147ad31135
|
@ -16,6 +16,14 @@ type DefaultDownloadStrategy struct {
|
|||
}
|
||||
|
||||
func (s *DefaultDownloadStrategy) FillRequests(t *torrent, c *connection) {
|
||||
if c.Interested {
|
||||
if c.PeerChoked {
|
||||
return
|
||||
}
|
||||
if len(c.Requests) >= c.PeerMaxRequests {
|
||||
return
|
||||
}
|
||||
}
|
||||
th := s.heat[t]
|
||||
addRequest := func(req request) (again bool) {
|
||||
piece := t.Pieces[req.Index]
|
||||
|
|
Loading…
Reference in New Issue