Skip to content

Instantly share code, notes, and snippets.

@rjrodger
Created February 8, 2011 21:30
Show Gist options
  • Save rjrodger/817293 to your computer and use it in GitHub Desktop.
Save rjrodger/817293 to your computer and use it in GitHub Desktop.
possible fix for issue with new Agent code in http.js where Agent in an error state stop working
socket.on('error', function(err) {
debug('AGENT SOCKET ERROR: ' + err.message);
var req;
if (socket._httpMessage) {
req = socket._httpMessage;
} else if (self.queue.length) {
req = self.queue.shift();
assert(req._queue === self.queue);
req._queue = null;
} else {
// No requests on queue? Where is the request
assert(0);
}
req.emit('error', err);
req._hadError = true; // hacky
// MY FIX
// DOES THIS WORK?
parser.finish();
socket.destroy();
self._removeSocket(socket);
parsers.free(parser);
self._cycle();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment