Commit 33dcef5f authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

p2p/net/swarm + conn: logs + debugerr output

parent d5a3bf1f
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
peer "github.com/jbenet/go-ipfs/p2p/peer" peer "github.com/jbenet/go-ipfs/p2p/peer"
eventlog "github.com/jbenet/go-ipfs/thirdparty/eventlog" eventlog "github.com/jbenet/go-ipfs/thirdparty/eventlog"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
debugerr "github.com/jbenet/go-ipfs/util/debugerror"
) )
var log = eventlog.Logger("conn") var log = eventlog.Logger("conn")
...@@ -50,7 +51,7 @@ func newSingleConn(ctx context.Context, local, remote peer.ID, maconn manet.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 // close is the internal close function, called by ContextCloser.Close
func (c *singleConn) Close() error { func (c *singleConn) Close() error {
log.Debugf("%s closing Conn with %s", c.local, c.remote) log.Debug(debugerr.Errorf("%s closing Conn with %s", c.local, c.remote))
// close underlying connection // close underlying connection
return c.msgrw.Close() return c.msgrw.Close()
} }
......
...@@ -75,6 +75,7 @@ func (l *listener) Accept() (net.Conn, error) { ...@@ -75,6 +75,7 @@ func (l *listener) Accept() (net.Conn, error) {
return nil, err return nil, err
} }
log.Debugf("listener %s got connection: %s <---> %s", l, maconn.LocalMultiaddr(), maconn.RemoteMultiaddr())
c, err := newSingleConn(ctx, l.local, "", maconn) c, err := newSingleConn(ctx, l.local, "", maconn)
if err != nil { if err != nil {
if catcher.IsTemporary(err) { if catcher.IsTemporary(err) {
...@@ -89,7 +90,7 @@ func (l *listener) Accept() (net.Conn, error) { ...@@ -89,7 +90,7 @@ func (l *listener) Accept() (net.Conn, error) {
} }
sc, err := newSecureConn(ctx, l.privk, c) sc, err := newSecureConn(ctx, l.privk, c)
if err != nil { if err != nil {
log.Info("ignoring conn we failed to secure: %s %s", err, sc) log.Infof("ignoring conn we failed to secure: %s %s", err, c)
continue continue
} }
return sc, nil return sc, nil
......
...@@ -65,7 +65,6 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error { ...@@ -65,7 +65,6 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error {
if err != nil { if err != nil {
return err return err
} }
log.Infof("Swarm Listening at %s", s.ListenAddresses())
// AddListener to the peerstream Listener. this will begin accepting connections // AddListener to the peerstream Listener. this will begin accepting connections
// and streams! // and streams!
...@@ -73,6 +72,7 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error { ...@@ -73,6 +72,7 @@ func (s *Swarm) setupListener(maddr ma.Multiaddr) error {
if err != nil { if err != nil {
return err return err
} }
log.Infof("Swarm Listeners at %s", s.ListenAddresses())
// go consume peerstream's listen accept errors. note, these ARE errors. // 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 // they may be killing the listener, and if we get _any_ we should be
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment