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
54abb97e
Commit
54abb97e
authored
Nov 30, 2018
by
needkane
Committed by
Felix Lange
Nov 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: use errors.New instead of fmt.Errorf (#18193)
parent
ef8ced41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
server.go
p2p/server.go
+4
-5
No files found.
p2p/server.go
View file @
54abb97e
...
...
@@ -22,7 +22,6 @@ import (
"crypto/ecdsa"
"encoding/hex"
"errors"
"fmt"
"net"
"sort"
"sync"
...
...
@@ -391,7 +390,7 @@ type sharedUDPConn struct {
func
(
s
*
sharedUDPConn
)
ReadFromUDP
(
b
[]
byte
)
(
n
int
,
addr
*
net
.
UDPAddr
,
err
error
)
{
packet
,
ok
:=
<-
s
.
unhandled
if
!
ok
{
return
0
,
nil
,
fmt
.
Errorf
(
"Connection was closed"
)
return
0
,
nil
,
errors
.
New
(
"Connection was closed"
)
}
l
:=
len
(
packet
.
Data
)
if
l
>
len
(
b
)
{
...
...
@@ -425,7 +424,7 @@ func (srv *Server) Start() (err error) {
// static fields
if
srv
.
PrivateKey
==
nil
{
return
fmt
.
Errorf
(
"Server.PrivateKey must be set to a non-nil key"
)
return
errors
.
New
(
"Server.PrivateKey must be set to a non-nil key"
)
}
if
srv
.
newTransport
==
nil
{
srv
.
newTransport
=
newRLPX
...
...
@@ -903,7 +902,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
if
dialDest
!=
nil
{
dialPubkey
=
new
(
ecdsa
.
PublicKey
)
if
err
:=
dialDest
.
Load
((
*
enode
.
Secp256k1
)(
dialPubkey
));
err
!=
nil
{
return
fmt
.
Errorf
(
"dial destination doesn't have a secp256k1 public key"
)
return
errors
.
New
(
"dial destination doesn't have a secp256k1 public key"
)
}
}
// Run the encryption handshake.
...
...
@@ -937,7 +936,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
return
err
}
if
id
:=
c
.
node
.
ID
();
!
bytes
.
Equal
(
crypto
.
Keccak256
(
phs
.
ID
),
id
[
:
])
{
clog
.
Trace
(
"Wrong devp2p handshake identity"
,
"phsid"
,
fmt
.
Sprintf
(
"%x"
,
phs
.
ID
))
clog
.
Trace
(
"Wrong devp2p handshake identity"
,
"phsid"
,
hex
.
EncodeToString
(
phs
.
ID
))
return
DiscUnexpectedIdentity
}
c
.
caps
,
c
.
name
=
phs
.
Caps
,
phs
.
Name
...
...
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