From: Matt Joiner Date: Mon, 1 Jun 2020 09:09:17 +0000 (+1000) Subject: Rename fastestConn->fastestPeer X-Git-Tag: v1.16.0~16^2~7 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=eb8688a902c58996dc78a96341166fa2c7285beb;p=btrtrc.git Rename fastestConn->fastestPeer --- diff --git a/peerconn.go b/peerconn.go index b10c95c0..0c328c22 100644 --- a/peerconn.go +++ b/peerconn.go @@ -329,7 +329,7 @@ func (cn *peer) writeStatus(w io.Writer, t *Torrent) { fmt.Fprintf(w, " next pieces: %v%s\n", iter.ToSlice(iter.Head(10, cn.iterPendingPiecesUntyped)), func() string { - if cn == t.fastestConn { + if cn == t.fastestPeer { return " (fastest)" } else { return "" @@ -1297,10 +1297,10 @@ func (c *peer) receiveChunk(msg *pp.Message) error { c.allStats(add(1, func(cs *ConnStats) *Count { return &cs.ChunksReadUseful })) c.allStats(add(int64(len(msg.Piece)), func(cs *ConnStats) *Count { return &cs.BytesReadUsefulData })) c.lastUsefulChunkReceived = time.Now() - // if t.fastestConn != c { + // if t.fastestPeer != c { // log.Printf("setting fastest connection %p", c) // } - t.fastestConn = c + t.fastestPeer = c // Need to record that it hasn't been written yet, before we attempt to do // anything with it. @@ -1618,7 +1618,7 @@ func (cn *peer) chunksReceivedWhileExpecting() int64 { } func (cn *peer) fastest() bool { - return cn == cn.t.fastestConn + return cn == cn.t.fastestPeer } func (cn *peer) peerMaxRequests() int { diff --git a/torrent.go b/torrent.go index 47225626..fcbf7ae9 100644 --- a/torrent.go +++ b/torrent.go @@ -92,7 +92,7 @@ type Torrent struct { // Set of addrs to which we're attempting to connect. Connections are // half-open until all handshakes are completed. halfOpen map[string]PeerInfo - fastestConn *peer + fastestPeer *peer // Reserve of peers to connect to. A peer can be both here and in the // active connections if were told about the peer after connecting with