From 60cecefc60c40a984416b33e589ebc2a27a4e908 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Mon, 19 Jan 2015 17:38:33 -0800 Subject: [PATCH] p2p/net/conn: log when reuse fails --- p2p/net/conn/dial.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/p2p/net/conn/dial.go b/p2p/net/conn/dial.go index 9c4b78431..ee9d9f4ad 100644 --- a/p2p/net/conn/dial.go +++ b/p2p/net/conn/dial.go @@ -91,11 +91,12 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee if laddr != nil { // dial using reuseport.Dialer, because we're probably reusing addrs. // this is optimistic, as the reuseDial may fail to bind the port. - log.Debugf("trying to reuse: %s", laddr) if nconn, err := d.reuseDial(laddr, raddr); err == nil { // if it worked, wrap the raw net.Conn with our manet.Conn - log.Debugf("reuse worked! %s %s %s", laddr, nconn.RemoteAddr(), nconn) + log.Debugf("%s reuse worked! %s %s %s", d.LocalPeer, laddr, nconn.RemoteAddr(), nconn) return manet.WrapNetConn(nconn) + } else { + log.Debugf("%s port reuse failed: %s %s", d.LocalPeer, laddr, err) } // if not, we fall back to regular Dial without a local addr specified. }