|
|
@ -27,6 +27,7 @@ var socketError = process.socketError; |
|
|
|
var getsockname = process.getsockname; |
|
|
|
var getaddrinfo = process.getaddrinfo; |
|
|
|
var needsLookup = process.needsLookup; |
|
|
|
var errnoException = process.errnoException; |
|
|
|
var EINPROGRESS = process.EINPROGRESS; |
|
|
|
var ENOENT = process.ENOENT; |
|
|
|
var END_OF_FILE = 0; |
|
|
@ -397,7 +398,7 @@ Socket.prototype.connect = function () { |
|
|
|
self._writeWatcher.set(self.fd, false, true); |
|
|
|
self._writeWatcher.start(); |
|
|
|
self._writeWatcher.callback = function () { |
|
|
|
var errno = socketError(self.fd); |
|
|
|
var errno = socketError(self.fd); |
|
|
|
if (errno == 0) { |
|
|
|
// connection established
|
|
|
|
self._readWatcher.start(); |
|
|
@ -406,9 +407,7 @@ Socket.prototype.connect = function () { |
|
|
|
self._writeWatcher.callback = self._doFlush; |
|
|
|
self.emit('connect'); |
|
|
|
} else if (errno != EINPROGRESS) { |
|
|
|
var e = new Error('connection error'); |
|
|
|
e.errno = errno; |
|
|
|
self.forceClose(e); |
|
|
|
self.forceClose(errnoException(errno, 'connect')); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|