summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2018-05-10 02:47:56 +0530
committerUjjwal Sharma <usharma1998@gmail.com>2018-05-20 02:06:26 +0530
commita7fa0dba88be73cc7210c21117c08281b0b45205 (patch)
treee6d0fcae7cc4b4b14a8652c341cfc0632433f1a6 /lib/net.js
parent9349e15daa803fc626581802fa827afe8d00340e (diff)
downloadandroid-node-v8-a7fa0dba88be73cc7210c21117c08281b0b45205.tar.gz
android-node-v8-a7fa0dba88be73cc7210c21117c08281b0b45205.tar.bz2
android-node-v8-a7fa0dba88be73cc7210c21117c08281b0b45205.zip
net,http2: refactor _write and _writev
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: https://github.com/nodejs/node/pull/20643 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/net.js b/lib/net.js
index 7d0a4a0e54..92b04838b6 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -744,13 +744,13 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
this._pendingData = null;
this._pendingEncoding = '';
- this._unrefTimer();
-
if (!this._handle) {
this.destroy(new ERR_SOCKET_CLOSED(), cb);
return false;
}
+ this._unrefTimer();
+
var req = createWriteWrap(this._handle, afterWrite);
if (writev)
writevGeneric(this, req, data, cb);