From 324cc7a28143c4885922e5741b08d19f2fc947b5 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 12 Jul 2018 09:42:00 +1000 Subject: [PATCH] Comments and trivial tweaks --- connection.go | 2 ++ peer_protocol/decoder.go | 2 +- peer_protocol/protocol.go | 2 +- torrent_test.go | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/connection.go b/connection.go index c791fb15..9bc13124 100644 --- a/connection.go +++ b/connection.go @@ -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 } diff --git a/peer_protocol/decoder.go b/peer_protocol/decoder.go index f07ed14b..47a8b65e 100644 --- a/peer_protocol/decoder.go +++ b/peer_protocol/decoder.go @@ -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 { diff --git a/peer_protocol/protocol.go b/peer_protocol/protocol.go index cf3e6e3d..c31a7e75 100644 --- a/peer_protocol/protocol.go +++ b/peer_protocol/protocol.go @@ -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 diff --git a/torrent_test.go b/torrent_test.go index 34e5e225..e10cc528 100644 --- a/torrent_test.go +++ b/torrent_test.go @@ -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()) -- 2.44.0