p2p/net/swarm: half the timeout of dial

This commit is contained in:
Juan Batiz-Benet 2015-01-22 19:32:32 -08:00
parent dec34b48e3
commit d5a3bf1fa8
1 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,9 @@ func (d *Dialer) reuseDial(laddr, raddr ma.Multiaddr) (conn net.Conn, retry bool
return nil, true, reuseport.ErrReuseFailed
}
// half the timeout so we can retry regularly if this fails.
d.Dialer.Dialer.Timeout = (d.Dialer.Dialer.Timeout / 2)
// give reuse.Dialer the manet.Dialer's Dialer.
// (wow, Dialer should've so been an interface...)
rd := reuseport.Dialer{d.Dialer.Dialer}