addrbook.go
func (a *AddrBook) expireNew(bucketIdx int) {
	for addrStr, ka := range a.addrNew[bucketIdx] {
		// If an entry is bad, throw it away
		if ka.isBad() {
			log.Notice(Fmt("expiring bad address %v", addrStr))
			a.removeFromBucket(ka, bucketTypeNew, bucketIdx)
			return
		}
	}

	// If we haven't thrown out a bad entry, throw out the oldest entry
	oldest := a.pickOldest(bucketTypeNew, bucketIdx)
	a.removeFromBucket(oldest, bucketTypeNew, bucketIdx)
}
func (a *AddrBook) expireNew(bucketIdx int) {
	for addrStr, ka := range a.addrNew[bucketIdx] {
		// If an entry is bad, throw it away
		if ka.isBad() {
			log.Notice(Fmt("expiring bad address %v", addrStr))
			a.removeFromBucket(ka, bucketTypeNew, bucketIdx)
			return
		}
	}

	// If we haven't thrown out a bad entry, throw out the oldest entry
	oldest := a.pickOldest(bucketTypeNew, bucketIdx)
	a.removeFromBucket(oldest, bucketTypeNew, bucketIdx)
}
func ( a * AddrBook ) expireNew ( bucketIdx int ) { for addrStr , ka := range a . addrNew [ bucketIdx ] { // If an entry is bad, throw it away if ka . isBad ( ) { log . Notice ( Fmt ( " " , addrStr ) ) a . removeFromBucket ( ka , bucketTypeNew , bucketIdx ) return } } // If we haven't thrown out a bad entry, throw out the oldest entry oldest := a . pickOldest ( bucketTypeNew , bucketIdx ) a . removeFromBucket ( oldest , bucketTypeNew , bucketIdx ) }
// Make space in the new buckets by expiring the really bad entries.
// If no bad entries are available we remove the oldest.
Make space in the new buckets by expiring the really bad entries . If no bad entries are available we remove the oldest .