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
46877f3f
Commit
46877f3f
authored
Feb 02, 2015
by
Juan Batiz-Benet
Browse files
p2p/protocol/id: log version mismatch disconnects
parent
884699e1
Changes
1
Show whitespace changes
Inline
Side-by-side
protocol/identify/id.go
View file @
46877f3f
...
...
@@ -16,6 +16,7 @@ import (
pb
"github.com/jbenet/go-ipfs/p2p/protocol/identify/pb"
config
"github.com/jbenet/go-ipfs/repo/config"
eventlog
"github.com/jbenet/go-ipfs/thirdparty/eventlog"
lgbl
"github.com/jbenet/go-ipfs/util/eventlog/loggables"
)
var
log
=
eventlog
.
Logger
(
"net/identify"
)
...
...
@@ -191,6 +192,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
// TODO: at this point, we've already exchanged information.
// move this into a first handshake before the connection can open streams.
if
!
protocolVersionsAreCompatible
(
pv
,
IpfsVersion
)
{
logProtocolMismatchDisconnect
(
c
,
pv
,
av
)
c
.
Close
()
return
}
...
...
@@ -309,3 +311,13 @@ func (nn *netNotifiee) OpenedStream(n inet.Network, v inet.Stream) {}
func
(
nn
*
netNotifiee
)
ClosedStream
(
n
inet
.
Network
,
v
inet
.
Stream
)
{}
func
(
nn
*
netNotifiee
)
Listen
(
n
inet
.
Network
,
a
ma
.
Multiaddr
)
{}
func
(
nn
*
netNotifiee
)
ListenClose
(
n
inet
.
Network
,
a
ma
.
Multiaddr
)
{}
func
logProtocolMismatchDisconnect
(
c
inet
.
Conn
,
protocol
,
agent
string
)
{
lm
:=
make
(
lgbl
.
DeferredMap
)
lm
[
"remotePeer"
]
=
func
()
interface
{}
{
return
c
.
RemotePeer
()
.
Pretty
()
}
lm
[
"remoteAddr"
]
=
func
()
interface
{}
{
return
c
.
RemoteMultiaddr
()
.
String
()
}
lm
[
"protocolVersion"
]
=
protocol
lm
[
"agentVersion"
]
=
agent
log
.
Event
(
context
.
TODO
(),
"IdentifyProtocolMismatch"
,
lm
)
log
.
Debug
(
"IdentifyProtocolMismatch %s %s %s (disconnected)"
,
c
.
RemotePeer
(),
protocol
,
agent
)
}
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