diff --git a/lib/net_uv.js b/lib/net_uv.js index 87b0affea43..d9e0f1b2c5d 100644 --- a/lib/net_uv.js +++ b/lib/net_uv.js @@ -310,6 +310,12 @@ Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) { } var writeReq = this._handle.write(data); + + if (!writeReq) { + this.destroy(errnoException(errno, 'write')); + return false; + } + writeReq.oncomplete = afterWrite; writeReq.cb = cb; this._writeRequests.push(writeReq);