Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
5076170f
Commit
5076170f
authored
May 25, 2015
by
Péter Szilágyi
Committed by
Felix Lange
May 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/discover: permit temporary bond failures for previously known nodes
parent
6078aa08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
table.go
p2p/discover/table.go
+15
-12
No files found.
p2p/discover/table.go
View file @
5076170f
...
...
@@ -324,6 +324,7 @@ func (tab *Table) bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16
fails
=
tab
.
db
.
findFails
(
id
)
}
// If the node is unknown (non-bonded) or failed (remotely unknown), bond from scratch
var
result
error
if
node
==
nil
||
fails
>
0
{
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Bonding %x: known=%v, fails=%v"
,
id
[
:
8
],
node
!=
nil
,
fails
)
...
...
@@ -345,22 +346,24 @@ func (tab *Table) bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16
delete
(
tab
.
bonding
,
id
)
tab
.
bondmu
.
Unlock
()
}
node
=
w
.
n
if
w
.
err
!=
nil
{
return
nil
,
w
.
err
// Retrieve the bonding results
result
=
w
.
err
if
result
==
nil
{
node
=
w
.
n
}
}
// Bonding succeeded, add to the table and reset previous findnode failures
tab
.
mutex
.
Lock
()
defer
tab
.
mutex
.
Unlock
()
// Even if bonding temporarily failed, give the node a chance
if
node
!=
nil
{
tab
.
mutex
.
Lock
()
defer
tab
.
mutex
.
Unlock
()
b
:=
tab
.
buckets
[
logdist
(
tab
.
self
.
sha
,
node
.
sha
)]
if
!
b
.
bump
(
node
)
{
tab
.
pingreplace
(
node
,
b
)
b
:=
tab
.
buckets
[
logdist
(
tab
.
self
.
sha
,
node
.
sha
)]
if
!
b
.
bump
(
node
)
{
tab
.
pingreplace
(
node
,
b
)
}
tab
.
db
.
updateFindFails
(
id
,
0
)
}
tab
.
db
.
updateFindFails
(
id
,
0
)
return
node
,
nil
return
node
,
result
}
func
(
tab
*
Table
)
pingpong
(
w
*
bondproc
,
pinged
bool
,
id
NodeID
,
addr
*
net
.
UDPAddr
,
tcpPort
uint16
)
{
...
...
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