Created
May 9, 2018 21:01
-
-
Save ryzokuken/cc6c972c6ad2f6e3057ad8c15a132d1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Socket.prototype._writeGeneric = function(writev, data, encoding, cb) { | |
// If we are still connecting, then buffer this for later. | |
// The Writable logic will buffer up any more writes while | |
// waiting for this one to be done. | |
if (this.connecting) { | |
this._pendingData = data; | |
this._pendingEncoding = encoding; | |
this.once('connect', function connect() { | |
this._writeGeneric(writev, data, encoding, cb); | |
}); | |
return; | |
} | |
this._pendingData = null; | |
this._pendingEncoding = ''; | |
this._unrefTimer(); | |
if (!this._handle) { | |
this.destroy(new ERR_SOCKET_CLOSED(), cb); | |
return false; | |
} | |
var req = createWriteWrap(this._handle, afterWrite); | |
if (writev) | |
writevGeneric(this, req, data, cb); | |
else | |
writeGeneric(this, req, data, encoding, cb); | |
if (req.async) | |
this[kLastWriteQueueSize] = req.bytes; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment