2
0
mirror of synced 2025-02-24 14:48:27 +00:00

Fix requests to other leechers

This commit is contained in:
Matt Joiner 2014-03-21 00:11:49 +11:00
parent 9e7caacbe3
commit 1b2a85600f

View File

@ -131,12 +131,12 @@ func (c *Connection) Post(msg encoding.BinaryMarshaler) {
// Returns true if more requests can be sent.
func (c *Connection) Request(chunk Request) bool {
if !c.PeerPieces[chunk.Index] {
panic("peer doesn't have that piece!")
}
if len(c.Requests) >= maxRequests {
return false
}
if !c.PeerPieces[chunk.Index] {
return true
}
c.SetInterested(true)
if c.PeerChoked {
return false