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
33dcef5f
Commit
33dcef5f
authored
Jan 22, 2015
by
Juan Batiz-Benet
Browse files
p2p/net/swarm + conn: logs + debugerr output
parent
d5a3bf1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
net/conn/conn.go
View file @
33dcef5f
...
...
@@ -15,6 +15,7 @@ import (
peer
"github.com/jbenet/go-ipfs/p2p/peer"
eventlog
"github.com/jbenet/go-ipfs/thirdparty/eventlog"
u
"github.com/jbenet/go-ipfs/util"
debugerr
"github.com/jbenet/go-ipfs/util/debugerror"
)
var
log
=
eventlog
.
Logger
(
"conn"
)
...
...
@@ -50,7 +51,7 @@ func newSingleConn(ctx context.Context, local, remote peer.ID, maconn manet.Conn
// close is the internal close function, called by ContextCloser.Close
func
(
c
*
singleConn
)
Close
()
error
{
log
.
Debugf
(
"%s closing Conn with %s"
,
c
.
local
,
c
.
remote
)
log
.
Debug
(
debugerr
.
Error
f
(
"%s closing Conn with %s"
,
c
.
local
,
c
.
remote
)
)
// close underlying connection
return
c
.
msgrw
.
Close
()
}
...
...
net/conn/listen.go
View file @
33dcef5f
...
...
@@ -75,6 +75,7 @@ func (l *listener) Accept() (net.Conn, error) {
return
nil
,
err
}
log
.
Debugf
(
"listener %s got connection: %s <---> %s"
,
l
,
maconn
.
LocalMultiaddr
(),
maconn
.
RemoteMultiaddr
())
c
,
err
:=
newSingleConn
(
ctx
,
l
.
local
,
""
,
maconn
)
if
err
!=
nil
{
if
catcher
.
IsTemporary
(
err
)
{
...
...
@@ -89,7 +90,7 @@ func (l *listener) Accept() (net.Conn, error) {
}
sc
,
err
:=
newSecureConn
(
ctx
,
l
.
privk
,
c
)
if
err
!=
nil
{
log
.
Info
(
"ignoring conn we failed to secure: %s %s"
,
err
,
s
c
)
log
.
Info
f
(
"ignoring conn we failed to secure: %s %s"
,
err
,
c
)
continue
}
return
sc
,
nil
...
...
net/swarm/swarm_listen.go
View file @
33dcef5f
...
...
@@ -65,7 +65,6 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error {
if
err
!=
nil
{
return
err
}
log
.
Infof
(
"Swarm Listening at %s"
,
s
.
ListenAddresses
())
// AddListener to the peerstream Listener. this will begin accepting connections
// and streams!
...
...
@@ -73,6 +72,7 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error {
if
err
!=
nil
{
return
err
}
log
.
Infof
(
"Swarm Listeners at %s"
,
s
.
ListenAddresses
())
// go consume peerstream's listen accept errors. note, these ARE errors.
// they may be killing the listener, and if we get _any_ we should be
...
...
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