func (a *AddrBook) addToOldBucket(ka *knownAddress, bucketIdx int) bool {
	// Sanity check
	if ka.isNew() {
		log.Warn(Fmt("Cannot add new address to old bucket: %v", ka))
		return false
	}
	if len(ka.Buckets) != 0 {
		log.Warn(Fmt("Cannot add already old address to another old bucket: %v", ka))
		return false
	}

	addrStr := ka.Addr.String()
	bucket := a.getBucket(bucketTypeNew, bucketIdx)

	// Already exists?
	if _, ok := bucket[addrStr]; ok {
		return true
	}

	// Enforce max addresses.
	if len(bucket) > oldBucketSize {
		return false
	}

	// Add to bucket.
	bucket[addrStr] = ka
	if ka.addBucketRef(bucketIdx) == 1 {
		a.nOld++
	}

	// Ensure in addrLookup
	a.addrLookup[addrStr] = ka

	return true
}
func (a *AddrBook) addToOldBucket(ka *knownAddress, bucketIdx int) bool {
	
	if ka.isNew() {
		log.Warn(Fmt("Cannot add new address to old bucket: %v", ka))
		return false
	}
	if len(ka.Buckets) != 0 {
		log.Warn(Fmt("Cannot add already old address to another old bucket: %v", ka))
		return false
	}

	addrStr := ka.Addr.String()
	bucket := a.getBucket(bucketTypeNew, bucketIdx)

	
	if _, ok := bucket[addrStr]; ok {
		return true
	}

	
	if len(bucket) > oldBucketSize {
		return false
	}

	
	bucket[addrStr] = ka
	if ka.addBucketRef(bucketIdx) == 1 {
		a.nOld++
	}

	
	a.addrLookup[addrStr] = ka

	return true
}
func ( a * AddrBook ) addToOldBucket ( ka * knownAddress , bucketIdx int ) bool { // Sanity check if ka . isNew ( ) { log . Warn ( Fmt ( " " , ka ) ) return false } if len ( ka . Buckets ) != 0 { log . Warn ( Fmt ( " " , ka ) ) return false } addrStr := ka . Addr . String ( ) bucket := a . getBucket ( bucketTypeNew , bucketIdx ) // Already exists? if _ , ok := bucket [ addrStr ] ; ok { return true } // Enforce max addresses. if len ( bucket ) > oldBucketSize { return false } // Add to bucket. bucket [ addrStr ] = ka if ka . addBucketRef ( bucketIdx ) == 1 { a . nOld ++ } // Ensure in addrLookup a . addrLookup [ addrStr ] = ka return true }
// Adds ka to old bucket. Returns false if it couldn't do it cuz buckets full.
Adds ka to old bucket . Returns false if it couldn t do it cuz buckets full .