Skip to content

Commit 02f6b66

Browse files
committed
swarm/network/simulations: overlay
1 parent 45769c5 commit 02f6b66

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

swarm/network/simulations/overlay.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ func (s *Simulation) NewService(id *adapters.NodeId, snapshot []byte) []node.Ser
4646

4747
kp := network.NewKadParams()
4848
kp.MinProxBinSize = 2
49-
kp.MaxBinSize = 8
50-
kp.MinBinSize = 2
49+
kp.MaxBinSize = 4
50+
kp.MinBinSize = 1
5151
kp.MaxRetries = 1000
5252
kp.RetryExponent = 2
5353
kp.RetryInterval = 1000
54+
kp.PruneInterval = 2000
5455
kad := network.NewKademlia(addr.Over(), kp)
55-
56+
ticker := time.NewTicker(time.Duration(kad.PruneInterval) * time.Millisecond)
57+
kad.Prune(ticker.C)
5658
hp := network.NewHiveParams()
5759
hp.KeepAliveInterval = 3 * time.Second
5860

@@ -94,7 +96,7 @@ func setupMocker(net *simulations.Network) []*adapters.NodeId {
9496
conf := net.Config()
9597
conf.DefaultService = "overlay"
9698

97-
nodeCount := 50
99+
nodeCount := 60
98100
ids := make([]*adapters.NodeId, nodeCount)
99101
for i := 0; i < nodeCount; i++ {
100102
node, err := net.NewNode()

0 commit comments

Comments
 (0)