go-imap
go-imap copied to clipboard
Fix connection hang
This PR fixes the issue described in #611.
If the server does not respond to the Support
calls in the New() function, the function blocks infinitely. Even if we supply a dialer with a timeout, there are 2 consequent Support
calls. The first one runs with a deadline value but during the execution of the 2nd one, the deadline was set to the zero value. Setting the timeout value to the client is not enough because the client is not returned to the user yet.
I also added an optional timeout parameter to the DialWithDialer
functions because callers may supply a Dialer that wraps the net.Dialer
, which was our case.