Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
network: Kademlia Load Balancing (#1774)
Browse files Browse the repository at this point in the history
* network: initial implementation for the proposed solution for peers load balancing in Kademlia as per SWIP 28
  • Loading branch information
kortatu authored and acud committed Nov 12, 2019
1 parent 7c508c6 commit 868b945
Show file tree
Hide file tree
Showing 14 changed files with 1,555 additions and 103 deletions.
6 changes: 3 additions & 3 deletions network/hive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func TestHiveStateConnections(t *testing.T) {

}
h1.Kademlia.lock.Lock()
numConns := h1.conns.Size()
numConns := h1.defaultIndex.conns.Size()
h1.Kademlia.lock.Unlock()
connAddresses := make(map[string]string)
h1.EachConn(h1.base, 255, func(peer *Peer, i int) bool {
Expand All @@ -271,12 +271,12 @@ func TestHiveStateConnections(t *testing.T) {
connsAfterLoading := 0
iterations := 0
h2.Kademlia.lock.Lock()
connsAfterLoading = h2.conns.Size()
connsAfterLoading = h2.defaultIndex.conns.Size()
h2.Kademlia.lock.Unlock()
for connsAfterLoading != numConns && iterations < 5 {
select {
case <-addedChan:
connsAfterLoading = h2.conns.Size()
connsAfterLoading = h2.defaultIndex.conns.Size()
case <-time.After(1 * time.Second):
iterations++
}
Expand Down
Loading

0 comments on commit 868b945

Please sign in to comment.