]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Rename fastestConn->fastestPeer
authorMatt Joiner <anacrolix@gmail.com>
Mon, 1 Jun 2020 09:09:17 +0000 (19:09 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 1 Jun 2020 09:09:17 +0000 (19:09 +1000)
peerconn.go
torrent.go

index b10c95c03f9df47e2ed68b27a0b5e45eb4b05bfe..0c328c2273dca71032836f2e65bc24e6868310e9 100644 (file)
@@ -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 {
index 47225626eb65c1467a3d9b38485a349d7b5ae6ce..fcbf7ae9798029024380a90a416d7632f9a25d03 100644 (file)
@@ -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