|
|
@ -45,7 +45,7 @@ function createTCP() { |
|
|
|
var FLAG_GOT_EOF = 1 << 0; |
|
|
|
var FLAG_SHUTDOWN = 1 << 1; |
|
|
|
var FLAG_DESTROY_SOON = 1 << 2; |
|
|
|
var FLAG_SHUTDOWNQUED = 1 << 3; |
|
|
|
var FLAG_SHUTDOWN_QUEUED = 1 << 3; |
|
|
|
|
|
|
|
|
|
|
|
var debug; |
|
|
@ -250,11 +250,11 @@ Socket.prototype.resume = function() { |
|
|
|
|
|
|
|
|
|
|
|
Socket.prototype.end = function(data, encoding) { |
|
|
|
if (this._connecting && ((this._flags & FLAG_SHUTDOWNQUED) == 0)) { |
|
|
|
if (this._connecting && ((this._flags & FLAG_SHUTDOWN_QUEUED) == 0)) { |
|
|
|
// still connecting, add data to buffer
|
|
|
|
if (data) this.write(data, encoding); |
|
|
|
this.writable = false; |
|
|
|
this._flags |= FLAG_SHUTDOWNQUED; |
|
|
|
this._flags |= FLAG_SHUTDOWN_QUEUED; |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.writable) return; |
|
|
@ -747,9 +747,9 @@ function afterConnect(status, handle, req, readable, writable) { |
|
|
|
|
|
|
|
self.emit('connect'); |
|
|
|
|
|
|
|
if (self._flags & FLAG_SHUTDOWNQUED) { |
|
|
|
if (self._flags & FLAG_SHUTDOWN_QUEUED) { |
|
|
|
// end called before connected - call end now with no data
|
|
|
|
self._flags &= ~FLAG_SHUTDOWNQUED; |
|
|
|
self._flags &= ~FLAG_SHUTDOWN_QUEUED; |
|
|
|
self.end(); |
|
|
|
} |
|
|
|
} else { |
|
|
|