From: Matt Joiner Date: Wed, 11 Jul 2018 23:42:00 +0000 (+1000) Subject: Comments and trivial tweaks X-Git-Tag: v1.0.0~84 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=324cc7a28143c4885922e5741b08d19f2fc947b5;p=btrtrc.git Comments and trivial tweaks --- 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())