Fix requests to other leechers
This commit is contained in:
parent
9e7caacbe3
commit
1b2a85600f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user