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
473d0256
Unverified
Commit
473d0256
authored
Apr 26, 2021
by
acud
Committed by
GitHub
Apr 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm: change MaxPO to 32 (#1593)
parent
25402864
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
6 deletions
+38
-6
kademlia.go
pkg/kademlia/kademlia.go
+16
-0
kademlia_test.go
pkg/kademlia/kademlia_test.go
+3
-3
pullstorage.go
pkg/pullsync/pullstorage/pullstorage.go
+2
-2
swarm.go
pkg/swarm/swarm.go
+1
-1
topology.go
pkg/topology/topology.go
+16
-0
No files found.
pkg/kademlia/kademlia.go
View file @
473d0256
...
...
@@ -1069,6 +1069,22 @@ func (k *Kad) Snapshot() *topology.KadParams {
Bin13
:
infos
[
13
],
Bin14
:
infos
[
14
],
Bin15
:
infos
[
15
],
Bin16
:
infos
[
16
],
Bin17
:
infos
[
17
],
Bin18
:
infos
[
18
],
Bin19
:
infos
[
19
],
Bin20
:
infos
[
20
],
Bin21
:
infos
[
21
],
Bin22
:
infos
[
22
],
Bin23
:
infos
[
23
],
Bin24
:
infos
[
24
],
Bin25
:
infos
[
25
],
Bin26
:
infos
[
26
],
Bin27
:
infos
[
27
],
Bin28
:
infos
[
28
],
Bin29
:
infos
[
29
],
Bin30
:
infos
[
30
],
Bin31
:
infos
[
31
],
},
}
}
...
...
pkg/kademlia/kademlia_test.go
View file @
473d0256
...
...
@@ -156,16 +156,16 @@ func TestNeighborhoodDepth(t *testing.T) {
// add a whole bunch of peers in bin 15, expect depth to stay at 15
for
i
:=
0
;
i
<
15
;
i
++
{
addr
=
test
.
RandomAddressAt
(
base
,
15
)
addr
=
test
.
RandomAddressAt
(
base
,
int
(
swarm
.
MaxPO
)
)
addOne
(
t
,
signer
,
kad
,
ab
,
addr
)
}
waitCounter
(
t
,
&
conns
,
15
)
kDepth
(
t
,
kad
,
15
)
kDepth
(
t
,
kad
,
31
)
// remove one at 14, depth should be 14
removeOne
(
kad
,
addrs
[
len
(
addrs
)
-
5
])
kDepth
(
t
,
kad
,
14
)
kDepth
(
t
,
kad
,
30
)
// empty bin 9 and expect depth 9
for
i
:=
0
;
i
<
4
;
i
++
{
...
...
pkg/pullsync/pullstorage/pullstorage.go
View file @
473d0256
...
...
@@ -120,8 +120,8 @@ LOOP:
// Cursors gets the last BinID for every bin in the local storage
func
(
s
*
ps
)
Cursors
(
ctx
context
.
Context
)
(
curs
[]
uint64
,
err
error
)
{
curs
=
make
([]
uint64
,
16
)
for
i
:=
uint8
(
0
);
i
<
16
;
i
++
{
curs
=
make
([]
uint64
,
swarm
.
MaxBins
)
for
i
:=
uint8
(
0
);
i
<
swarm
.
MaxBins
;
i
++
{
binID
,
err
:=
s
.
Storer
.
LastPullSubscriptionBinID
(
i
)
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/swarm/swarm.go
View file @
473d0256
...
...
@@ -23,7 +23,7 @@ const (
BmtBranches
=
128
ChunkSize
=
SectionSize
*
Branches
HashSize
=
32
MaxPO
uint8
=
15
MaxPO
uint8
=
31
ExtendedPO
uint8
=
MaxPO
+
5
MaxBins
=
MaxPO
+
1
ChunkWithSpanSize
=
ChunkSize
+
SpanSize
...
...
pkg/topology/topology.go
View file @
473d0256
...
...
@@ -88,6 +88,22 @@ type KadBins struct {
Bin13
BinInfo
`json:"bin_13"`
Bin14
BinInfo
`json:"bin_14"`
Bin15
BinInfo
`json:"bin_15"`
Bin16
BinInfo
`json:"bin_16"`
Bin17
BinInfo
`json:"bin_17"`
Bin18
BinInfo
`json:"bin_18"`
Bin19
BinInfo
`json:"bin_19"`
Bin20
BinInfo
`json:"bin_20"`
Bin21
BinInfo
`json:"bin_21"`
Bin22
BinInfo
`json:"bin_22"`
Bin23
BinInfo
`json:"bin_23"`
Bin24
BinInfo
`json:"bin_24"`
Bin25
BinInfo
`json:"bin_25"`
Bin26
BinInfo
`json:"bin_26"`
Bin27
BinInfo
`json:"bin_27"`
Bin28
BinInfo
`json:"bin_28"`
Bin29
BinInfo
`json:"bin_29"`
Bin30
BinInfo
`json:"bin_30"`
Bin31
BinInfo
`json:"bin_31"`
}
type
KadParams
struct
{
...
...
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