Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
f1dd3185
Commit
f1dd3185
authored
Nov 28, 2017
by
Aviv Eyal
Committed by
Steven Allen
Feb 21, 2018
Browse files
Formatting
parent
c6bfb4d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/multipro/node.go
View file @
f1dd3185
...
...
@@ -44,7 +44,7 @@ func NewMessageData(nodeId string, messageId string, gossip bool) *p2p.MessageDa
// Node type - implements one or more p2p protocols
type
Node
struct
{
host
host
.
Host
// lib-p2p host
host
host
.
Host
// lib-p2p host
*
PingProtocol
// ping protocol impl
*
EchoProtocol
// echo protocol impl
}
...
...
examples/multipro/ping.go
View file @
f1dd3185
...
...
@@ -26,10 +26,10 @@ type PingProtocol struct {
}
func
NewPingProtocol
(
host
host
.
Host
,
done
chan
bool
)
*
PingProtocol
{
p
:=
PingProtocol
{
host
:
host
,
requests
:
make
(
map
[
string
]
*
p2p
.
PingRequest
),
done
:
done
}
p
:=
&
PingProtocol
{
host
:
host
,
requests
:
make
(
map
[
string
]
*
p2p
.
PingRequest
),
done
:
done
}
host
.
SetStreamHandler
(
pingRequest
,
p
.
onPingRequest
)
host
.
SetStreamHandler
(
pingResponse
,
p
.
onPingResponse
)
return
&
p
return
p
}
// remote peer requests handler
...
...
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