2
0
mirror of synced 2025-02-24 06:38:14 +00:00

Rename fastestConn->fastestPeer

This commit is contained in:
Matt Joiner 2020-06-01 19:09:17 +10:00
parent 5602ecd810
commit eb8688a902
2 changed files with 5 additions and 5 deletions

View 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 {

View 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