Browse Source

Sockets should never be attached to a ClientRequest before nextTick().

This way the API for interacting directly with the socket object is
consistent before and after the Agent pool is exhausted.

Fixes #1601.
Mikeal Rogers 14 years ago
committed by Ryan Dahl
parent
commit
7c87e092fb
  1. 6
      lib/http2.js

6
lib/http2.js

@ -1070,9 +1070,9 @@ ClientRequest.prototype.abort = function() {
};
ClientRequest.prototype.onSocket = function(socket) {
var parser = parsers.alloc();
var req = this;
process.nextTick(function () {
var parser = parsers.alloc();
req.socket = socket;
req.connection = socket;
parser.reinitialize('response');
@ -1209,9 +1209,9 @@ ClientRequest.prototype.onSocket = function(socket) {
return isHeadResponse;
};
process.nextTick(function() {
req.emit('socket', socket);
});
};
ClientRequest.prototype._deferToConnect = function(method, arguments, cb) {
// This function is for calls that need to happen once the socket is

Loading…
Cancel
Save