Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kbucket
Commits
a3a726cb
Commit
a3a726cb
authored
May 23, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: avoid hashing under a lock
parent
80d3b476
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
table.go
table.go
+3
-2
No files found.
table.go
View file @
a3a726cb
...
...
@@ -113,11 +113,12 @@ func (rt *RoutingTable) Update(p peer.ID) (evicted peer.ID, err error) {
// Remove deletes a peer from the routing table. This is to be used
// when we are sure a node has disconnected completely.
func
(
rt
*
RoutingTable
)
Remove
(
p
peer
.
ID
)
{
rt
.
tabLock
.
Lock
()
defer
rt
.
tabLock
.
Unlock
()
peerID
:=
ConvertPeerID
(
p
)
cpl
:=
CommonPrefixLen
(
peerID
,
rt
.
local
)
rt
.
tabLock
.
Lock
()
defer
rt
.
tabLock
.
Unlock
()
bucketID
:=
cpl
if
bucketID
>=
len
(
rt
.
Buckets
)
{
bucketID
=
len
(
rt
.
Buckets
)
-
1
...
...
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