@cryptotaxi247 / kubo / commits / 60cecefc6

p2p/net/conn: log when reuse fails

Juan Batiz-Benet committed Jan 19, 2015 at 17:38 UTC 60cecefc60c40a984416b33e589ebc2a27a4e908
1 file changed +3 -2
p2p/net/conn/dial.go
+3 -2
@@ -91,11 +91,12 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee
91 if laddr != nil {
92 // dial using reuseport.Dialer, because we're probably reusing addrs.
93 // this is optimistic, as the reuseDial may fail to bind the port.
94 - log.Debugf("trying to reuse: %s", laddr)
94 if nconn, err := d.reuseDial(laddr, raddr); err == nil {
95 // if it worked, wrap the raw net.Conn with our manet.Conn
97 - log.Debugf("reuse worked! %s %s %s", laddr, nconn.RemoteAddr(), nconn)
96 + log.Debugf("%s reuse worked! %s %s %s", d.LocalPeer, laddr, nconn.RemoteAddr(), nconn)
97 return manet.WrapNetConn(nconn)
98 + } else {
99 + log.Debugf("%s port reuse failed: %s %s", d.LocalPeer, laddr, err)
100 }
101 // if not, we fall back to regular Dial without a local addr specified.
102 }