Rename fastestConn->fastestPeer
This commit is contained in:
parent
5602ecd810
commit
eb8688a902
@ -329,7 +329,7 @@ func (cn *peer) writeStatus(w io.Writer, t *Torrent) {
|
|||||||
fmt.Fprintf(w, " next pieces: %v%s\n",
|
fmt.Fprintf(w, " next pieces: %v%s\n",
|
||||||
iter.ToSlice(iter.Head(10, cn.iterPendingPiecesUntyped)),
|
iter.ToSlice(iter.Head(10, cn.iterPendingPiecesUntyped)),
|
||||||
func() string {
|
func() string {
|
||||||
if cn == t.fastestConn {
|
if cn == t.fastestPeer {
|
||||||
return " (fastest)"
|
return " (fastest)"
|
||||||
} else {
|
} else {
|
||||||
return ""
|
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(1, func(cs *ConnStats) *Count { return &cs.ChunksReadUseful }))
|
||||||
c.allStats(add(int64(len(msg.Piece)), func(cs *ConnStats) *Count { return &cs.BytesReadUsefulData }))
|
c.allStats(add(int64(len(msg.Piece)), func(cs *ConnStats) *Count { return &cs.BytesReadUsefulData }))
|
||||||
c.lastUsefulChunkReceived = time.Now()
|
c.lastUsefulChunkReceived = time.Now()
|
||||||
// if t.fastestConn != c {
|
// if t.fastestPeer != c {
|
||||||
// log.Printf("setting fastest connection %p", 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
|
// Need to record that it hasn't been written yet, before we attempt to do
|
||||||
// anything with it.
|
// anything with it.
|
||||||
@ -1618,7 +1618,7 @@ func (cn *peer) chunksReceivedWhileExpecting() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cn *peer) fastest() bool {
|
func (cn *peer) fastest() bool {
|
||||||
return cn == cn.t.fastestConn
|
return cn == cn.t.fastestPeer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cn *peer) peerMaxRequests() int {
|
func (cn *peer) peerMaxRequests() int {
|
||||||
|
@ -92,7 +92,7 @@ type Torrent struct {
|
|||||||
// Set of addrs to which we're attempting to connect. Connections are
|
// Set of addrs to which we're attempting to connect. Connections are
|
||||||
// half-open until all handshakes are completed.
|
// half-open until all handshakes are completed.
|
||||||
halfOpen map[string]PeerInfo
|
halfOpen map[string]PeerInfo
|
||||||
fastestConn *peer
|
fastestPeer *peer
|
||||||
|
|
||||||
// Reserve of peers to connect to. A peer can be both here and in the
|
// 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
|
// active connections if were told about the peer after connecting with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user