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
6e001215
Unverified
Commit
6e001215
authored
Jun 24, 2020
by
acud
Committed by
GitHub
Jun 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kademlia: dont connect to the same peer again in short interval (#352)
parent
584343e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
kademlia.go
pkg/kademlia/kademlia.go
+4
-3
No files found.
pkg/kademlia/kademlia.go
View file @
6e001215
...
...
@@ -30,6 +30,7 @@ const (
var
(
errMissingAddressBookEntry
=
errors
.
New
(
"addressbook underlay entry not found"
)
timeToRetry
=
60
*
time
.
Second
shortRetry
=
30
*
time
.
Second
)
type
binSaturationFunc
func
(
bin
,
depth
uint8
,
peers
*
pslice
.
PSlice
)
bool
...
...
@@ -161,12 +162,12 @@ func (k *Kad) manage() {
return
false
,
false
,
nil
}
k
.
connectedPeers
.
Add
(
peer
,
po
)
k
.
waitNextMu
.
Lock
()
delete
(
k
.
waitNext
,
peer
.
String
())
k
.
waitNext
[
peer
.
String
()]
=
retryInfo
{
tryAfter
:
time
.
Now
()
.
Add
(
shortRetry
)}
k
.
waitNextMu
.
Unlock
()
k
.
connectedPeers
.
Add
(
peer
,
po
)
k
.
depthMu
.
Lock
()
k
.
depth
=
k
.
recalcDepth
()
k
.
depthMu
.
Unlock
()
...
...
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