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
dd871e79
Commit
dd871e79
authored
Feb 19, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: initialize Server.ourHandshake before accepting connections
parent
3dbd3209
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
server.go
p2p/server.go
+9
-8
No files found.
p2p/server.go
View file @
dd871e79
...
...
@@ -160,7 +160,7 @@ func (srv *Server) Start() (err error) {
}
srvlog
.
Infoln
(
"Starting Server"
)
//
initialize all the
fields
//
static
fields
if
srv
.
PrivateKey
==
nil
{
return
fmt
.
Errorf
(
"Server.PrivateKey must be set to a non-nil key"
)
}
...
...
@@ -170,31 +170,32 @@ func (srv *Server) Start() (err error) {
srv
.
quit
=
make
(
chan
struct
{})
srv
.
peers
=
make
(
map
[
discover
.
NodeID
]
*
Peer
)
srv
.
peerConnect
=
make
(
chan
*
discover
.
Node
)
if
srv
.
setupFunc
==
nil
{
srv
.
setupFunc
=
setupConn
}
if
srv
.
Blacklist
==
nil
{
srv
.
Blacklist
=
NewBlacklist
()
}
if
srv
.
ListenAddr
!=
""
{
if
err
:=
srv
.
startListening
();
err
!=
nil
{
return
err
}
}
//
dial stuff
//
node table
ntab
,
err
:=
discover
.
ListenUDP
(
srv
.
PrivateKey
,
srv
.
ListenAddr
,
srv
.
NAT
)
if
err
!=
nil
{
return
err
}
srv
.
ntab
=
ntab
// handshake
srv
.
ourHandshake
=
&
protoHandshake
{
Version
:
baseProtocolVersion
,
Name
:
srv
.
Name
,
ID
:
ntab
.
Self
()}
for
_
,
p
:=
range
srv
.
Protocols
{
srv
.
ourHandshake
.
Caps
=
append
(
srv
.
ourHandshake
.
Caps
,
p
.
cap
())
}
// listen/dial
if
srv
.
ListenAddr
!=
""
{
if
err
:=
srv
.
startListening
();
err
!=
nil
{
return
err
}
}
if
srv
.
Dialer
==
nil
{
srv
.
Dialer
=
&
net
.
Dialer
{
Timeout
:
defaultDialTimeout
}
}
...
...
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