@@ -444,13 +444,6 @@ function socketErrorListener(err) { |
444 | 444 | socket.destroy(); |
445 | 445 | } |
446 | 446 |
|
447 | | -function freeSocketErrorListener(err) { |
448 | | - const socket = this; |
449 | | - debug('SOCKET ERROR on FREE socket:', err.message, err.stack); |
450 | | - socket.destroy(); |
451 | | - socket.emit('agentRemove'); |
452 | | -} |
453 | | - |
454 | 447 | function socketOnEnd() { |
455 | 448 | const socket = this; |
456 | 449 | const req = this._httpMessage; |
@@ -629,8 +622,11 @@ function responseKeepAlive(req) { |
629 | 622 | socket.removeListener('error', socketErrorListener); |
630 | 623 | socket.removeListener('data', socketOnData); |
631 | 624 | socket.removeListener('end', socketOnEnd); |
632 | | - socket.once('error', freeSocketErrorListener); |
633 | | - // There are cases where _handle === null. Avoid those. Passing null to |
| 625 | + |
| 626 | + // TODO(ronag): Between here and emitFreeNT the socket |
| 627 | + // has no 'error' handler. |
| 628 | + |
| 629 | + // There are cases where _handle === null. Avoid those. Passing undefined to |
634 | 630 | // nextTick() will call getDefaultTriggerAsyncId() to retrieve the id. |
635 | 631 | const asyncId = socket._handle ? socket._handle.getAsyncId() : undefined; |
636 | 632 | // Mark this socket as available, AFTER user-added end |
@@ -699,7 +695,6 @@ function tickOnSocket(req, socket) { |
699 | 695 | } |
700 | 696 |
|
701 | 697 | parser.onIncoming = parserOnIncomingClient; |
702 | | - socket.removeListener('error', freeSocketErrorListener); |
703 | 698 | socket.on('error', socketErrorListener); |
704 | 699 | socket.on('data', socketOnData); |
705 | 700 | socket.on('end', socketOnEnd); |
@@ -739,6 +734,8 @@ function listenSocketTimeout(req) { |
739 | 734 | } |
740 | 735 |
|
741 | 736 | ClientRequest.prototype.onSocket = function onSocket(socket) { |
| 737 | + // TODO(ronag): Between here and onSocketNT the socket |
| 738 | + // has no 'error' handler. |
742 | 739 | process.nextTick(onSocketNT, this, socket); |
743 | 740 | }; |
744 | 741 |
|
|