From 82ee860e8dd582e4deadee560c8a8cd7a9646f8f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 4 Apr 2016 15:28:25 +1000 Subject: [PATCH] Apply unconvert linter --- client.go | 14 +++++++------- torrent.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client.go b/client.go index 5444cea2..6ecfb13b 100644 --- a/client.go +++ b/client.go @@ -118,8 +118,8 @@ func (cl *Client) queuePieceCheck(t *Torrent, pieceIndex int) { return } piece.QueuedForHash = true - t.publishPieceChange(int(pieceIndex)) - go cl.verifyPiece(t, int(pieceIndex)) + t.publishPieceChange(pieceIndex) + go cl.verifyPiece(t, pieceIndex) } // Queue a piece check if one isn't already queued, and the piece has never @@ -1377,7 +1377,7 @@ func (me *Client) connectionLoop(t *Torrent, c *connection) error { for i, cp := range pexMsg.Added { p := Peer{ IP: make([]byte, 4), - Port: int(cp.Port), + Port: cp.Port, Source: peerSourcePEX, } if i < len(pexMsg.AddedFlags) && pexMsg.AddedFlags[i]&0x01 != 0 { @@ -1958,12 +1958,12 @@ func (cl *Client) announceTorrentDHT(t *Torrent, impliedPort bool) { } addPeers = append(addPeers, Peer{ IP: cp.IP[:], - Port: int(cp.Port), + Port: cp.Port, Source: peerSourceDHT, }) key := (&net.UDPAddr{ IP: cp.IP[:], - Port: int(cp.Port), + Port: cp.Port, }).String() allAddrs[key] = struct{}{} } @@ -2228,7 +2228,7 @@ func (me *Client) pieceHashed(t *Torrent, piece int, correct bool) { } } p.EverHashed = true - touchers := me.reapPieceTouches(t, int(piece)) + touchers := me.reapPieceTouches(t, piece) if correct { err := p.Storage().MarkComplete() if err != nil { @@ -2241,7 +2241,7 @@ func (me *Client) pieceHashed(t *Torrent, piece int, correct bool) { me.dropConnection(t, c) } } - me.pieceChanged(t, int(piece)) + me.pieceChanged(t, piece) } func (me *Client) onCompletedPiece(t *Torrent, piece int) { diff --git a/torrent.go b/torrent.go index ae1a10d3..4e0082a6 100644 --- a/torrent.go +++ b/torrent.go @@ -351,7 +351,7 @@ func (t *Torrent) newMetadataExtensionMessage(c *connection, msgType int, piece } return pp.Message{ Type: pp.Extended, - ExtendedID: byte(c.PeerExtensionIDs["ut_metadata"]), + ExtendedID: c.PeerExtensionIDs["ut_metadata"], ExtendedPayload: append(p, data...), } } @@ -643,7 +643,7 @@ func (t *Torrent) pieceLength(piece int) (len_ pp.Integer) { if piece < 0 || piece >= t.info.NumPieces() { return } - if int(piece) == t.numPieces()-1 { + if piece == t.numPieces()-1 { len_ = pp.Integer(t.length % t.info.PieceLength) } if len_ == 0 {