Skip to content

Commit

Permalink
Rename exported Peer and PeerConn receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Jan 19, 2024
1 parent 3cc8774 commit f067eff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
14 changes: 7 additions & 7 deletions peerconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f067eff

Please sign in to comment.