Browse Source

net.js: don't pretend that everything is okay when unwrapping fails

In case of an UNWRAP failure, the binding returns -1, which is truthy.
v0.9.1-release
Bert Belder 13 years ago
parent
commit
bb675baaa9
  1. 2
      lib/net.js

2
lib/net.js

@ -512,7 +512,7 @@ Socket.prototype._write = function(data, encoding, cb) {
// `encoding` is unused right now, `data` is always a buffer. // `encoding` is unused right now, `data` is always a buffer.
var writeReq = this._handle.write(data); var writeReq = this._handle.write(data);
if (!writeReq) { if (!writeReq || typeof writeReq !== 'object') {
this._destroy(errnoException(errno, 'write'), cb); this._destroy(errnoException(errno, 'write'), cb);
return false; return false;
} }

Loading…
Cancel
Save