Fix DialTimeout for direct call of Dial (#691)

* ensure dialTimeout is used at Dial time. Ensure dial functions setup the right timeout

* - on Dialing, ensure a dialTimeout for the Dialer only if it is just created, else keep going with parameters of the Dialer.
This commit is contained in:
Francois Tur 2018-06-04 16:36:08 -04:00 committed by Miek Gieben
parent 8ccae88257
commit d8bd04e7e1
1 changed files with 1 additions and 2 deletions

View File

@ -89,11 +89,10 @@ func (c *Client) Dial(address string) (conn *Conn, err error) {
// create a new dialer with the appropriate timeout
var d net.Dialer
if c.Dialer == nil {
d = net.Dialer{}
d = net.Dialer{Timeout:c.getTimeoutForRequest(c.dialTimeout())}
} else {
d = net.Dialer(*c.Dialer)
}
d.Timeout = c.getTimeoutForRequest(c.writeTimeout())
network := "udp"
useTLS := false