]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Rename exported Peer and PeerConn receivers v1.53.3
authorMatt Joiner <anacrolix@gmail.com>
Tue, 16 Jan 2024 09:15:14 +0000 (20:15 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 19 Jan 2024 05:38:31 +0000 (16:38 +1100)
peer.go
peerconn.go

diff --git a/peer.go b/peer.go
index c4b4fb9e0e95faff1c6493d984c94fd8d6442543..608ccb12144c6ed86d87dfd2abbc4ed22cea803a 100644 (file)
--- a/peer.go
+++ b/peer.go
@@ -244,11 +244,11 @@ func (cn *Peer) downloadRate() float64 {
        return float64(num) / cn.totalExpectingTime().Seconds()
 }
 
-func (cn *Peer) DownloadRate() float64 {
-       cn.locker().RLock()
-       defer cn.locker().RUnlock()
+func (p *Peer) DownloadRate() float64 {
+       p.locker().RLock()
+       defer p.locker().RUnlock()
 
-       return cn.downloadRate()
+       return p.downloadRate()
 }
 
 func (cn *Peer) iterContiguousPieceRequests(f func(piece pieceIndex, count int)) {
index 0dd99cef1f86216d35c50c8641d06aa4711c46c0..ee47dd1b2505e6cf56a3e837962cedb91cce4df1 100644 (file)
@@ -1097,16 +1097,16 @@ func (c *PeerConn) pexEvent(t pexEventType) (_ pexEvent, err error) {
        return pexEvent{t, addr, f, nil}, nil
 }
 
-func (c *PeerConn) String() string {
-       return fmt.Sprintf("%T %p [id=%+q, exts=%v, v=%q]", c, c, c.PeerID, c.PeerExtensionBytes, c.PeerClientName.Load())
+func (pc *PeerConn) String() string {
+       return fmt.Sprintf("%T %p [id=%+q, exts=%v, v=%q]", pc, pc, pc.PeerID, pc.PeerExtensionBytes, pc.PeerClientName.Load())
 }
 
 // Returns the pieces the peer could have based on their claims. If we don't know how many pieces
-// are in the torrent, it could be a very large range the peer has sent HaveAll.
-func (cn *PeerConn) PeerPieces() *roaring.Bitmap {
-       cn.locker().RLock()
-       defer cn.locker().RUnlock()
-       return cn.newPeerPieces()
+// are in the torrent, it could be a very large range if the peer has sent HaveAll.
+func (pc *PeerConn) PeerPieces() *roaring.Bitmap {
+       pc.locker().RLock()
+       defer pc.locker().RUnlock()
+       return pc.newPeerPieces()
 }
 
 func (pc *PeerConn) remoteIsTransmission() bool {