Comments and trivial tweaks

This commit is contained in:
Matt Joiner 2018-07-12 09:42:00 +10:00
parent ee985e51cb
commit 324cc7a281
4 changed files with 5 additions and 3 deletions

View File

@ -1472,6 +1472,8 @@ func (c *connection) deleteRequest(r request) bool {
panic(n)
}
c.updateRequests()
// TODO: Other connections that aren't interested, and can provide this
// chunk might be wakeable?
return true
}

View File

@ -35,7 +35,7 @@ func (d *Decoder) Decode(msg *Message) (err error) {
return
}
msg.Keepalive = false
r := &io.LimitedReader{R:d.R, N:int64(length)}
r := &io.LimitedReader{R: d.R, N: int64(length)}
// Check that all of r was utilized.
defer func() {
if err != nil {

View File

@ -25,7 +25,7 @@ const (
Cancel MessageType = 8
Port MessageType = 9
// BEP 6
// BEP 6 - Fast extension
Suggest MessageType = 0x0d // 13
HaveAll MessageType = 0x0e // 14
HaveNone MessageType = 0x0f // 15

View File

@ -189,7 +189,7 @@ func TestTorrentMetainfoIncompleteMetadata(t *testing.T) {
assert.True(t, ok)
assert.True(t, hr.PeerExtensionBits.GetBit(pp.ExtensionBitExtended))
assert.EqualValues(t, cl.PeerID(), hr.PeerID)
assert.Equal(t, ih, hr.Hash)
assert.EqualValues(t, ih, hr.Hash)
assert.EqualValues(t, 0, tt.metadataSize())