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
f2447bd4
Commit
f2447bd4
authored
May 03, 2018
by
GagziW
Committed by
Péter Szilágyi
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: changed if-else blocks to conform with golint (#16660)
parent
ea1724de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
message.go
p2p/message.go
+14
-15
network.go
p2p/simulations/network.go
+1
-2
No files found.
p2p/message.go
View file @
f2447bd4
...
...
@@ -229,21 +229,20 @@ func ExpectMsg(r MsgReader, code uint64, content interface{}) error {
}
if
content
==
nil
{
return
msg
.
Discard
()
}
else
{
contentEnc
,
err
:=
rlp
.
EncodeToBytes
(
content
)
if
err
!=
nil
{
panic
(
"content encode error: "
+
err
.
Error
())
}
if
int
(
msg
.
Size
)
!=
len
(
contentEnc
)
{
return
fmt
.
Errorf
(
"message size mismatch: got %d, want %d"
,
msg
.
Size
,
len
(
contentEnc
))
}
actualContent
,
err
:=
ioutil
.
ReadAll
(
msg
.
Payload
)
if
err
!=
nil
{
return
err
}
if
!
bytes
.
Equal
(
actualContent
,
contentEnc
)
{
return
fmt
.
Errorf
(
"message payload mismatch:
\n
got: %x
\n
want: %x"
,
actualContent
,
contentEnc
)
}
}
contentEnc
,
err
:=
rlp
.
EncodeToBytes
(
content
)
if
err
!=
nil
{
panic
(
"content encode error: "
+
err
.
Error
())
}
if
int
(
msg
.
Size
)
!=
len
(
contentEnc
)
{
return
fmt
.
Errorf
(
"message size mismatch: got %d, want %d"
,
msg
.
Size
,
len
(
contentEnc
))
}
actualContent
,
err
:=
ioutil
.
ReadAll
(
msg
.
Payload
)
if
err
!=
nil
{
return
err
}
if
!
bytes
.
Equal
(
actualContent
,
contentEnc
)
{
return
fmt
.
Errorf
(
"message payload mismatch:
\n
got: %x
\n
want: %x"
,
actualContent
,
contentEnc
)
}
return
nil
}
...
...
p2p/simulations/network.go
View file @
f2447bd4
...
...
@@ -738,7 +738,6 @@ func (self *Network) executeNodeEvent(e *Event) error {
func
(
self
*
Network
)
executeConnEvent
(
e
*
Event
)
error
{
if
e
.
Conn
.
Up
{
return
self
.
Connect
(
e
.
Conn
.
One
,
e
.
Conn
.
Other
)
}
else
{
return
self
.
Disconnect
(
e
.
Conn
.
One
,
e
.
Conn
.
Other
)
}
return
self
.
Disconnect
(
e
.
Conn
.
One
,
e
.
Conn
.
Other
)
}
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