Commit 6ebba718 authored by Jeromy's avatar Jeromy

clean up reusedial and remove go-libp2p-logging

parent 823812a5
......@@ -7,12 +7,6 @@
"dvcsimport": "github.com/libp2p/go-tcp-transport"
},
"gxDependencies": [
{
"author": "whyrusleeping",
"hash": "QmXs1igHHEaUmMxKtbP8Z9wTjitQ75sqxaKQP4QgnLN4nn",
"name": "go-libp2p-loggables",
"version": "1.1.1"
},
{
"author": "whyrusleeping",
"hash": "QmeJcz1smiskcJbPRTWpzqnLpD2vYqkNiGHVrckaaWHCLv",
......
......@@ -9,7 +9,6 @@ import (
logging "github.com/ipfs/go-log"
reuseport "github.com/jbenet/go-reuseport"
lgbl "github.com/libp2p/go-libp2p-loggables"
tpt "github.com/libp2p/go-libp2p-transport"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
......@@ -202,33 +201,27 @@ func (d *tcpDialer) DialContext(ctx context.Context, raddr ma.Multiaddr) (tpt.Co
}
func (d *tcpDialer) reuseDial(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error) {
logdial := lgbl.Dial("conn", "", "", d.laddr, raddr)
rpev := log.EventBegin(ctx, "tptDialReusePort", logdial)
network, netraddr, err := manet.DialArgs(raddr)
if err != nil {
return nil, err
}
_ = ctx // TODO: implement DialContext in reuseport
rpev := log.EventBegin(ctx, "tptDialReusePort", logging.LoggableMap{
"raddr": raddr,
})
con, err := d.rd.DialContext(ctx, network, netraddr)
if err == nil {
logdial["reuseport"] = "success"
rpev.Done()
return manet.WrapNetConn(con)
}
rpev.SetError(err)
rpev.Done()
if !ReuseErrShouldRetry(err) {
logdial["reuseport"] = "failure"
logdial["error"] = err
rpev.Done()
return nil, err
}
logdial["reuseport"] = "retry"
logdial["error"] = err
rpev.Done()
return d.madialer.DialContext(ctx, raddr)
}
......
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