Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
f0019754
Commit
f0019754
authored
Sep 23, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #104 from jbenet/feat/fix-ping
Fixed Ping (minor)
parents
9eabd80e
10a1a01c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
crypto/spipe/handshake.go
crypto/spipe/handshake.go
+21
-5
routing/dht/handlers.go
routing/dht/handlers.go
+1
-2
No files found.
crypto/spipe/handshake.go
View file @
f0019754
...
...
@@ -67,8 +67,12 @@ func (s *SecurePipe) handshake() error {
return
err
}
// u.POut("sending encoded handshake\n")
s
.
insecure
.
Out
<-
encoded
// Send our Propose packet
select
{
case
s
.
insecure
.
Out
<-
encoded
:
case
<-
s
.
ctx
.
Done
()
:
return
ErrClosed
}
// Parse their Propose packet and generate an Exchange packet.
// Exchange = (EphemeralPubKey, Signature)
...
...
@@ -137,7 +141,12 @@ func (s *SecurePipe) handshake() error {
exEncoded
,
err
:=
proto
.
Marshal
(
exPacket
)
s
.
insecure
.
Out
<-
exEncoded
// send out Exchange packet
select
{
case
s
.
insecure
.
Out
<-
exEncoded
:
case
<-
s
.
ctx
.
Done
()
:
return
ErrClosed
}
// Parse their Exchange packet and generate a Finish packet.
// Finish = E('Finish')
...
...
@@ -182,7 +191,14 @@ func (s *SecurePipe) handshake() error {
finished
:=
[]
byte
(
"Finished"
)
s
.
Out
<-
finished
// send finished msg
select
{
case
<-
s
.
ctx
.
Done
()
:
return
ErrClosed
case
s
.
Out
<-
finished
:
}
// recv finished msg
var
resp2
[]
byte
select
{
case
<-
s
.
ctx
.
Done
()
:
...
...
@@ -194,7 +210,7 @@ func (s *SecurePipe) handshake() error {
return
errors
.
New
(
"Negotiation failed."
)
}
u
.
DOut
(
"[%s]
identify
: Got node id: %s
\n
"
,
s
.
local
.
ID
.
Pretty
(),
s
.
remote
.
ID
.
Pretty
())
u
.
DOut
(
"[%s]
handshake
: Got node id: %s
\n
"
,
s
.
local
.
ID
.
Pretty
(),
s
.
remote
.
ID
.
Pretty
())
return
nil
}
...
...
routing/dht/handlers.go
View file @
f0019754
...
...
@@ -104,8 +104,7 @@ func (dht *IpfsDHT) handlePutValue(p *peer.Peer, pmes *Message) (*Message, error
func
(
dht
*
IpfsDHT
)
handlePing
(
p
*
peer
.
Peer
,
pmes
*
Message
)
(
*
Message
,
error
)
{
u
.
DOut
(
"[%s] Responding to ping from [%s]!
\n
"
,
dht
.
self
.
ID
.
Pretty
(),
p
.
ID
.
Pretty
())
return
newMessage
(
pmes
.
GetType
(),
""
,
int
(
pmes
.
GetClusterLevel
())),
nil
return
pmes
,
nil
}
func
(
dht
*
IpfsDHT
)
handleFindPeer
(
p
*
peer
.
Peer
,
pmes
*
Message
)
(
*
Message
,
error
)
{
...
...
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