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) {
...
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
// ok try to setup the new connection.
// ok try to setup the new connection.
swarmC
,
err
:=
dialConnSetup
(
ctx
,
s
,
connC
)
swarmC
,
err
:=
dialConnSetup
(
ctx
,
s
,
connC
)
if
err
!=
nil
{
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
))
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
connC
.
Close
()
// close the connection. didn't work out :(
connC
.
Close
()
// close the connection. didn't work out :(
return
nil
,
err
return
nil
,
err
...
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
...
@@ -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)
// ok try to setup the new connection. (newConnSetup will add to group)
swarmC
,
err
:=
s
.
newConnSetup
(
ctx
,
psC
)
swarmC
,
err
:=
s
.
newConnSetup
(
ctx
,
psC
)
if
err
!=
nil
{
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
))
log
.
Event
(
ctx
,
"dialFailureDisconnect"
,
lgbl
.
NetConn
(
connC
),
lgbl
.
Error
(
err
))
psC
.
Close
()
// we need to make sure psC is Closed.
psC
.
Close
()
// we need to make sure psC is Closed.
return
nil
,
err
return
nil
,
err
...
...
protocol/identify/id.go
View file @
ae0386cf
...
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
...
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
// ok give the response to our handler.
// ok give the response to our handler.
if
err
:=
protocol
.
WriteHeader
(
s
,
ID
);
err
!=
nil
{
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
())
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
}
}
ids
.
ResponseHandler
(
s
)
ids
.
ResponseHandler
(
s
)
...
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
...
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
r
:=
ggio
.
NewDelimitedReader
(
s
,
2048
)
r
:=
ggio
.
NewDelimitedReader
(
s
,
2048
)
mes
:=
pb
.
Identify
{}
mes
:=
pb
.
Identify
{}
if
err
:=
r
.
ReadMsg
(
&
mes
);
err
!=
nil
{
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
)
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
(),
err
)
return
return
}
}
...
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
...
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
for
_
,
addr
:=
range
laddrs
{
for
_
,
addr
:=
range
laddrs
{
maddr
,
err
:=
ma
.
NewMultiaddrBytes
(
addr
)
maddr
,
err
:=
ma
.
NewMultiaddrBytes
(
addr
)
if
err
!=
nil
{
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
())
p
,
c
.
RemoteMultiaddr
())
continue
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