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
7702e9b8
Commit
7702e9b8
authored
Nov 29, 2017
by
Aviv Eyal
Committed by
Steven Allen
Feb 21, 2018
Browse files
Minor code cleanup
parent
49182bcf
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/multipro/echo.go
View file @
7702e9b8
...
...
@@ -50,8 +50,6 @@ func (e *EchoProtocol) onEchoRequest(s inet.Stream) {
if
!
valid
{
log
.
Println
(
"Failed to authenticate message"
)
return
}
else
{
//log.Println("Authenticated request content was generated by author node :-)")
}
log
.
Printf
(
"%s: Sending echo response to %s. Message id: %s..."
,
s
.
Conn
()
.
LocalPeer
(),
s
.
Conn
()
.
RemotePeer
(),
data
.
MessageData
.
Id
)
...
...
@@ -100,8 +98,6 @@ func (e *EchoProtocol) onEchoResponse(s inet.Stream) {
if
!
valid
{
log
.
Println
(
"Failed to authenticate message"
)
return
}
else
{
//log.Println("Authenticated response content generated by claimed node :-)")
}
// locate request data and remove it if found
...
...
examples/multipro/main.go
View file @
7702e9b8
...
...
@@ -27,8 +27,6 @@ func makeRandomNode(port int, done chan bool) *Node {
n
,
_
:=
swarm
.
NewNetwork
(
context
.
Background
(),
[]
ma
.
Multiaddr
{
listen
},
pid
,
peerStore
,
nil
)
host
:=
bhost
.
New
(
n
)
log
.
Printf
(
"New host id (base58 multihash):%s, length:%d"
,
host
.
ID
()
.
Pretty
(),
len
(
host
.
ID
()
.
Pretty
()))
return
NewNode
(
host
,
done
)
}
...
...
@@ -48,7 +46,7 @@ func main() {
log
.
Printf
(
"This is a conversation between %s and %s
\n
"
,
h1
.
ID
(),
h2
.
ID
())
//
send messages using the
protocols
//
test implemented
protocols
h1
.
Ping
(
h2
.
Host
)
h2
.
Ping
(
h1
.
Host
)
h1
.
Echo
(
h2
.
Host
)
...
...
examples/multipro/ping.go
View file @
7702e9b8
...
...
@@ -51,8 +51,6 @@ func (p *PingProtocol) onPingRequest(s inet.Stream) {
if
!
valid
{
log
.
Println
(
"Failed to authenticate message"
)
return
}
else
{
//log.Println("Authenticated request content was generated by claimed node :-)")
}
// generate response message
...
...
@@ -99,8 +97,6 @@ func (p *PingProtocol) onPingResponse(s inet.Stream) {
if
!
valid
{
log
.
Println
(
"Failed to authenticate message"
)
return
}
else
{
//log.Println("Authenticated response content generated by claimed node :-)")
}
// locate request data and remove it if found
...
...
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