diff --git a/bzz/netstore.go b/bzz/netstore.go index cf7bc26ec1..33d39dabdd 100644 --- a/bzz/netstore.go +++ b/bzz/netstore.go @@ -198,8 +198,8 @@ func (self *NetStore) addRetrieveRequest(req *retrieveRequestMsgData) { // it's assumed that caller holds the lock func (self *NetStore) startSearch(chunk *Chunk, id int64, timeout *time.Time) { chunk.req.status = reqSearching - dpaLogger.Debugf("NetStore.startSearch: %064x - getting peers from KΛÐΞMLIΛ...", chunk.Key) peers := self.hive.getPeers(chunk.Key, 0) + dpaLogger.Debugf("NetStore.startSearch: %064x - received %d peers from KΛÐΞMLIΛ...", chunk.Key, len(peers)) req := &retrieveRequestMsgData{ Key: chunk.Key, Id: uint64(id), diff --git a/common/kademlia/kademlia.go b/common/kademlia/kademlia.go index 5a699a9bb6..40b83b9f99 100644 --- a/common/kademlia/kademlia.go +++ b/common/kademlia/kademlia.go @@ -252,6 +252,7 @@ func (self *Kademlia) getNodes(target Address, max int) (r nodesByDistance) { start := index var down bool if index >= self.proxLimit { + index = self.proxLimit start = self.MaxProx down = true } @@ -266,8 +267,8 @@ func (self *Kademlia) getNodes(target Address, max int) (r nodesByDistance) { r.push(bucket[i], limit) n++ } - if max == 0 && start == index || - max > 0 && down && start <= index && (n >= max || n == self.Count() || start == 0) { + if max == 0 && start <= index && n > 0 || + max > 0 && down && start <= index && (n >= limit || n == self.Count() || start == 0) { break } if down { @@ -453,7 +454,6 @@ bit first). proximity(x, y) counts the common zeros in the front of this distance measure. */ func proximity(one, other Address) (ret int) { - fmt.Printf("%08b ^ %08b = %08b\n", one[0], other[0], one[0]^other[0]) for i := 0; i < len(one); i++ { oxo := one[i] ^ other[i] for j := 0; j < 8; j++ {