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
c53c5e61
Commit
c53c5e61
authored
Mar 20, 2019
by
Felföldi Zsolt
Committed by
Péter Szilágyi
Mar 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les: fix peer id and reply error handling (#19289)
* les: fixed peer id format * les: fixed peer reply error handling
parent
e7d18679
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
handler.go
les/handler.go
+9
-1
peer.go
les/peer.go
+2
-3
No files found.
les/handler.go
View file @
c53c5e61
...
...
@@ -329,6 +329,11 @@ func (pm *ProtocolManager) handle(p *peer) error {
// handleMsg is invoked whenever an inbound message is received from a remote
// peer. The remote connection is torn down upon returning any error.
func
(
pm
*
ProtocolManager
)
handleMsg
(
p
*
peer
)
error
{
select
{
case
err
:=
<-
p
.
errCh
:
return
err
default
:
}
// Read the next message from the remote peer, and ensure it's fully consumed
msg
,
err
:=
p
.
rw
.
ReadMsg
()
if
err
!=
nil
{
...
...
@@ -389,7 +394,10 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
if
reply
!=
nil
{
p
.
queueSend
(
func
()
{
if
err
:=
reply
.
send
(
bv
);
err
!=
nil
{
p
.
errCh
<-
err
select
{
case
p
.
errCh
<-
err
:
default
:
}
}
})
}
...
...
les/peer.go
View file @
c53c5e61
...
...
@@ -98,15 +98,14 @@ type peer struct {
}
func
newPeer
(
version
int
,
network
uint64
,
isTrusted
bool
,
p
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
*
peer
{
id
:=
p
.
ID
()
return
&
peer
{
Peer
:
p
,
rw
:
rw
,
version
:
version
,
network
:
network
,
id
:
fmt
.
Sprintf
(
"%x"
,
id
),
id
:
fmt
.
Sprintf
(
"%x"
,
p
.
ID
()
.
Bytes
()
),
isTrusted
:
isTrusted
,
errCh
:
make
(
chan
error
,
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