Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created March 28, 2013 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/5265427 to your computer and use it in GitHub Desktop.
Save isaacs/5265427 to your computer and use it in GitHub Desktop.
diff --git a/lib/http.js b/lib/http.js
index dacedd4..c828e63 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -514,23 +514,8 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding) {
return this.connection.write(data, encoding);
} else if (this.connection && this.connection.destroyed) {
// The socket was destroyed. If we're still trying to write to it,
- // then something bad happened, but it could be just that we haven't
- // gotten the 'close' event yet.
- //
- // In v0.10 and later, this isn't a problem, since ECONNRESET isn't
- // ignored in the first place. We'll probably emit 'close' on the
- // next tick, but just in case it's not coming, set a timeout that
- // will emit it for us.
- if (!this._hangupClose) {
- this._hangupClose = true;
- var socket = this.socket;
- var timer = setTimeout(function() {
- socket.emit('close');
- });
- socket.once('close', function() {
- clearTimeout(timer);
- });
- }
+ // then something bad happened, but we probably just haven't gotten
+ // the close or error yet, so in the meantime, just stop writing.
return false;
} else {
// buffer, as long as we're not destroyed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment