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
ae0386cf
Commit
ae0386cf
authored
Jan 24, 2015
by
Juan Batiz-Benet
Browse files
user friendliness in logs + output
parent
44fe2f07
Changes
2
Hide whitespace changes
Inline
Side-by-side
net/swarm/swarm_dial.go
View file @
ae0386cf
...
...
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
// ok try to setup the new connection.
swarmC
,
err
:=
dialConnSetup
(
ctx
,
s
,
connC
)
if
err
!=
nil
{
log
.
Error
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Debug
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
connC
.
Close
()
// close the connection. didn't work out :(
return
nil
,
err
...
...
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
// ok try to setup the new connection. (newConnSetup will add to group)
swarmC
,
err
:=
s
.
newConnSetup
(
ctx
,
psC
)
if
err
!=
nil
{
log
.
Error
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Debug
(
"Dial newConnSetup failed. disconnecting."
)
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
psC
.
Close
()
// we need to make sure psC is Closed.
return
nil
,
err
...
...
protocol/identify/id.go
View file @
ae0386cf
...
...
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
// ok give the response to our handler.
if
err
:=
protocol
.
WriteHeader
(
s
,
ID
);
err
!=
nil
{
log
.
Error
(
"error writing stream header for %s"
,
ID
)
log
.
Debugf
(
"error writing stream header for %s"
,
ID
)
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
}
ids
.
ResponseHandler
(
s
)
...
...
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
r
:=
ggio
.
NewDelimitedReader
(
s
,
2048
)
mes
:=
pb
.
Identify
{}
if
err
:=
r
.
ReadMsg
(
&
mes
);
err
!=
nil
{
log
.
Error
f
(
"%s error receiving message from %s %s %s"
,
ID
,
log
.
Debug
f
(
"%s error receiving message from %s %s %s"
,
ID
,
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
(),
err
)
return
}
...
...
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
for
_
,
addr
:=
range
laddrs
{
maddr
,
err
:=
ma
.
NewMultiaddrBytes
(
addr
)
if
err
!=
nil
{
log
.
Error
f
(
"%s failed to parse multiaddr from %s %s"
,
ID
,
log
.
Debug
f
(
"%s failed to parse multiaddr from %s %s"
,
ID
,
p
,
c
.
RemoteMultiaddr
())
continue
}
...
...
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