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
5235e01b
Commit
5235e01b
authored
May 27, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: hard disconnect if a peer is flaky
parent
8951a03d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
handler.go
eth/handler.go
+12
-4
No files found.
eth/handler.go
View file @
5235e01b
...
@@ -93,14 +93,22 @@ func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpo
...
@@ -93,14 +93,22 @@ func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpo
}
}
func
(
pm
*
ProtocolManager
)
removePeer
(
id
string
)
{
func
(
pm
*
ProtocolManager
)
removePeer
(
id
string
)
{
// Unregister the peer from the downloader
// Short circuit if the peer was already removed
pm
.
downloader
.
UnregisterPeer
(
id
)
peer
:=
pm
.
peers
.
Peer
(
id
)
if
peer
==
nil
{
return
}
glog
.
V
(
logger
.
Debug
)
.
Infoln
(
"Removing peer"
,
id
)
//
Remove the peer from the Ethereum peer set too
//
Unregister the peer from the downloader and Ethereum peer set
glog
.
V
(
logger
.
Detail
)
.
Infoln
(
"Removing peer"
,
id
)
pm
.
downloader
.
UnregisterPeer
(
id
)
if
err
:=
pm
.
peers
.
Unregister
(
id
);
err
!=
nil
{
if
err
:=
pm
.
peers
.
Unregister
(
id
);
err
!=
nil
{
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Removal failed:"
,
err
)
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Removal failed:"
,
err
)
}
}
// Hard disconnect at the networking layer
if
peer
!=
nil
{
peer
.
Peer
.
Disconnect
(
p2p
.
DiscUselessPeer
)
}
}
}
func
(
pm
*
ProtocolManager
)
Start
()
{
func
(
pm
*
ProtocolManager
)
Start
()
{
...
...
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