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 ""
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.
}
func (cn *peer) fastest() bool {
- return cn == cn.t.fastestConn
+ return cn == cn.t.fastestPeer
}
func (cn *peer) peerMaxRequests() int {
// 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