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
f63cb278
Commit
f63cb278
authored
Sep 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tmp
parent
954ba211
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
peer.go
peer.go
+15
-14
No files found.
peer.go
View file @
f63cb278
...
...
@@ -182,6 +182,7 @@ func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer {
inbound
:
false
,
connected
:
0
,
disconnect
:
0
,
port
:
30303
,
caps
:
caps
,
version
:
ethereum
.
ClientIdentity
()
.
String
(),
}
...
...
@@ -629,17 +630,6 @@ func (p *Peer) pushPeers() {
p
.
QueueMessage
(
p
.
peersMessage
())
}
func
(
p
*
Peer
)
pushHandshake
()
error
{
pubkey
:=
p
.
ethereum
.
KeyManager
()
.
PublicKey
()
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgHandshakeTy
,
[]
interface
{}{
uint32
(
0
),
[]
byte
(
p
.
version
),
[]
string
{
"eth"
},
p
.
port
,
pubkey
[
1
:
],
})
p
.
QueueMessage
(
msg
)
return
nil
}
func
(
self
*
Peer
)
pushStatus
()
{
const
netVersion
=
0
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgStatusTy
,
[]
interface
{}{
...
...
@@ -673,8 +663,21 @@ func (self *Peer) handleStatus(msg *ethwire.Msg) {
ethlogger
.
Infof
(
"Peer is [ETH] capable. (TD = %v ~ %x"
,
self
.
td
,
self
.
bestHash
)
}
func
(
p
*
Peer
)
pushHandshake
()
error
{
pubkey
:=
p
.
ethereum
.
KeyManager
()
.
PublicKey
()
fmt
.
Println
(
"pubkey"
,
pubkey
)
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgHandshakeTy
,
[]
interface
{}{
uint32
(
0
),
[]
byte
(
p
.
version
),
[]
string
{
"eth"
},
uint32
(
p
.
port
),
pubkey
[
1
:
],
})
p
.
QueueMessage
(
msg
)
return
nil
}
func
(
p
*
Peer
)
handleHandshake
(
msg
*
ethwire
.
Msg
)
{
c
:=
msg
.
Data
fmt
.
Println
(
c
,
c
.
Len
())
var
(
p2pVersion
=
c
.
Get
(
0
)
.
Uint
()
...
...
@@ -684,8 +687,6 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
pub
=
c
.
Get
(
4
)
.
Bytes
()
)
fmt
.
Println
(
"PEER CAPS"
,
caps
)
// Check correctness of p2p protocol version
if
p2pVersion
!=
P2PVersion
{
peerlogger
.
Debugf
(
"Invalid P2P version. Require protocol %d, received %d
\n
"
,
P2PVersion
,
p2pVersion
)
...
...
@@ -735,7 +736,7 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
p
.
ethereum
.
PushPeer
(
p
)
p
.
ethereum
.
reactor
.
Post
(
"peerList"
,
p
.
ethereum
.
Peers
())
ethlogger
.
Infof
(
"Added peer (%s) %d / %d
\n
"
,
p
.
conn
.
RemoteAddr
(),
p
.
ethereum
.
Peers
()
.
Len
(),
p
.
ethereum
.
MaxPeer
s
)
ethlogger
.
Infof
(
"Added peer (%s) %d / %d
(%v)
\n
"
,
p
.
conn
.
RemoteAddr
(),
p
.
ethereum
.
Peers
()
.
Len
(),
p
.
ethereum
.
MaxPeers
,
cap
s
)
peerlogger
.
Debugln
(
p
)
...
...
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