func (t *Torrent) worstBadConn() *PeerConn {
	wcs := worseConnSlice{t.unclosedConnsAsSlice()}
	heap.Init(&wcs)
	for wcs.Len() != 0 {
		c := heap.Pop(&wcs).(*PeerConn)
		if c._stats.ChunksReadWasted.Int64() >= 6 && c._stats.ChunksReadWasted.Int64() > c._stats.ChunksReadUseful.Int64() {
			return c
		}
		// If the connection is in the worst half of the established
		// connection quota and is older than a minute.
		if wcs.Len() >= (t.maxEstablishedConns+1)/2 {
			// Give connections 1 minute to prove themselves.
			if time.Since(c.completedHandshake) > time.Minute {
				return c
			}
		}
	}
	return nil
}
// The worst connection is one that hasn't been sent, or sent anything useful
// for the longest. A bad connection is one that usually sends us unwanted
// pieces, or has been in worser half of the established connections for more
// than a minute.
The worst connection is one that hasn't been sent, or sent anything useful
for the longest. A bad connection is one that usually sends us unwanted
pieces, or has been in worser half of the established connections for more
than a minute.
// The worst connection is one that hasn ' t been sent or sent anything useful // for the longest . A bad connection is one that usually sends us unwanted // pieces or has been in worser half of the established connections for more // than a minute .
func (t *Torrent) worstBadConn() *PeerConn {
	wcs := worseConnSlice{t.unclosedConnsAsSlice()}
	heap.Init(&wcs)
	for wcs.Len() != 0 {
		c := heap.Pop(&wcs).(*PeerConn)
		if c._stats.ChunksReadWasted.Int64() >= 6 && c._stats.ChunksReadWasted.Int64() > c._stats.ChunksReadUseful.Int64() {
			return c
		}
		if wcs.Len() >= (t.maxEstablishedConns+1)/2 {
			if time.Since(c.completedHandshake) > time.Minute {
				return c
			}
		}
	}
	return nil
}
func ( t * Torrent ) worstBadConn ( ) * PeerConn { wcs := worseConnSlice { t . unclosedConnsAsSlice ( ) } heap . Init ( & wcs ) for wcs . Len ( ) != 0 { c := heap . Pop ( & wcs ) . ( * PeerConn ) if c . _stats . ChunksReadWasted . Int64 ( ) >= 6 && c . _stats . ChunksReadWasted . Int64 ( ) > c . _stats . ChunksReadUseful . Int64 ( ) { return c } if wcs . Len ( ) >= ( t . maxEstablishedConns + 1 ) / 2 { if time . Since ( c . completedHandshake ) > time . Minute { return c } } } return nil }
The worst connection is one that hasn't been sent, or sent anything useful
for the longest.
The worst connection is one that hasn ' t been sent or sent anything useful for the longest .
// If the connection is in the worst half of the established // connection quota and is older than a minute. // Give connections 1 minute to prove themselves.