Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
67cc8f24
Unverified
Commit
67cc8f24
authored
May 20, 2021
by
metacertain
Committed by
GitHub
May 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
param: change binsize (#1729)
parent
dc9a129a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
kademlia.go
pkg/topology/kademlia/kademlia.go
+2
-2
kademlia_test.go
pkg/topology/kademlia/kademlia_test.go
+19
-0
No files found.
pkg/topology/kademlia/kademlia.go
View file @
67cc8f24
...
@@ -32,13 +32,13 @@ const (
...
@@ -32,13 +32,13 @@ const (
nnLowWatermark
=
2
// the number of peers in consecutive deepest bins that constitute as nearest neighbours
nnLowWatermark
=
2
// the number of peers in consecutive deepest bins that constitute as nearest neighbours
maxConnAttempts
=
3
// when there is maxConnAttempts failed connect calls for a given peer it is considered non-connectable
maxConnAttempts
=
3
// when there is maxConnAttempts failed connect calls for a given peer it is considered non-connectable
maxBootnodeAttempts
=
3
// how many attempts to dial to bootnodes before giving up
maxBootnodeAttempts
=
3
// how many attempts to dial to bootnodes before giving up
defaultBitSuffixLength
=
2
// the number of bits used to create pseudo addresses for balancing
defaultBitSuffixLength
=
3
// the number of bits used to create pseudo addresses for balancing
peerConnectionAttemptTimeout
=
5
*
time
.
Second
// Timeout for establishing a new connection with peer.
peerConnectionAttemptTimeout
=
5
*
time
.
Second
// Timeout for establishing a new connection with peer.
)
)
var
(
var
(
saturationPeers
=
4
saturationPeers
=
8
overSaturationPeers
=
16
overSaturationPeers
=
16
bootnodeOverSaturationPeers
=
64
bootnodeOverSaturationPeers
=
64
shortRetry
=
30
*
time
.
Second
shortRetry
=
30
*
time
.
Second
...
...
pkg/topology/kademlia/kademlia_test.go
View file @
67cc8f24
...
@@ -46,6 +46,11 @@ var nonConnectableAddress, _ = ma.NewMultiaddr(underlayBase + "16Uiu2HAkx8ULY8cT
...
@@ -46,6 +46,11 @@ var nonConnectableAddress, _ = ma.NewMultiaddr(underlayBase + "16Uiu2HAkx8ULY8cT
// A more in depth testing of the functionality in `manage()` is explicitly
// A more in depth testing of the functionality in `manage()` is explicitly
// tested in TestManage below.
// tested in TestManage below.
func
TestNeighborhoodDepth
(
t
*
testing
.
T
)
{
func
TestNeighborhoodDepth
(
t
*
testing
.
T
)
{
defer
func
(
p
int
)
{
*
kademlia
.
SaturationPeers
=
p
}(
*
kademlia
.
SaturationPeers
)
*
kademlia
.
SaturationPeers
=
4
var
(
var
(
conns
int32
// how many connect calls were made to the p2p mock
conns
int32
// how many connect calls were made to the p2p mock
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{})
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{})
...
@@ -306,6 +311,10 @@ func TestManage(t *testing.T) {
...
@@ -306,6 +311,10 @@ func TestManage(t *testing.T) {
func
TestManageWithBalancing
(
t
*
testing
.
T
)
{
func
TestManageWithBalancing
(
t
*
testing
.
T
)
{
// use "fixed" seed for this
// use "fixed" seed for this
defer
func
(
p
int
)
{
*
kademlia
.
SaturationPeers
=
p
}(
*
kademlia
.
SaturationPeers
)
*
kademlia
.
SaturationPeers
=
4
rand
.
Seed
(
2
)
rand
.
Seed
(
2
)
var
(
var
(
...
@@ -488,6 +497,11 @@ func TestOversaturationBootnode(t *testing.T) {
...
@@ -488,6 +497,11 @@ func TestOversaturationBootnode(t *testing.T) {
}(
*
kademlia
.
OverSaturationPeers
)
}(
*
kademlia
.
OverSaturationPeers
)
*
kademlia
.
OverSaturationPeers
=
4
*
kademlia
.
OverSaturationPeers
=
4
defer
func
(
p
int
)
{
*
kademlia
.
SaturationPeers
=
p
}(
*
kademlia
.
SaturationPeers
)
*
kademlia
.
SaturationPeers
=
4
var
(
var
(
conns
int32
// how many connect calls were made to the p2p mock
conns
int32
// how many connect calls were made to the p2p mock
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{
BootnodeMode
:
true
})
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{
BootnodeMode
:
true
})
...
@@ -544,6 +558,11 @@ func TestBootnodeMaxConnections(t *testing.T) {
...
@@ -544,6 +558,11 @@ func TestBootnodeMaxConnections(t *testing.T) {
}(
*
kademlia
.
BootnodeOverSaturationPeers
)
}(
*
kademlia
.
BootnodeOverSaturationPeers
)
*
kademlia
.
BootnodeOverSaturationPeers
=
4
*
kademlia
.
BootnodeOverSaturationPeers
=
4
defer
func
(
p
int
)
{
*
kademlia
.
SaturationPeers
=
p
}(
*
kademlia
.
SaturationPeers
)
*
kademlia
.
SaturationPeers
=
4
var
(
var
(
conns
int32
// how many connect calls were made to the p2p mock
conns
int32
// how many connect calls were made to the p2p mock
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{
BootnodeMode
:
true
})
base
,
kad
,
ab
,
_
,
signer
=
newTestKademlia
(
t
,
&
conns
,
nil
,
kademlia
.
Options
{
BootnodeMode
:
true
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment