diff --git a/lib/connect.js b/lib/connect.js index 603f1981..9a1e064f 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -96,6 +96,7 @@ function connect(url, socketOptions, openCallback) { var noDelay = !!sockopts.noDelay; var timeout = sockopts.timeout; + var postConnectTimeout = sockopts.postConnectTimeout || 300000 var keepAlive = !!sockopts.keepAlive; // 0 is default for node var keepAliveDelay = sockopts.keepAliveDelay || 0; @@ -145,9 +146,8 @@ function connect(url, socketOptions, openCallback) { var c = new Connection(sock); c.open(fields, function(err, ok) { - // disable timeout once the connection is open, we don't want - // it fouling things - if (timeout) sock.setTimeout(0); + // revert to post-connection timeout (typically requires longer timeouts) + sock.setTimeout(postConnectTimeout); if (err === null) { openCallback(null, c); }