Skip to content

Commit

Permalink
another stab at proper 0.5 agent socket closing
Browse files Browse the repository at this point in the history
  • Loading branch information
einaros committed Oct 23, 2011
1 parent bc15077 commit f6c376d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ HTTPClient.prototype.request = function (path, opts, fn) {
HTTPClient.prototype.end = function () {
var self = this;
Object.keys(this.agent.sockets).forEach(function (socket) {
if (self.agent.sockets[socket].length > 0 &&
self.agent.sockets[socket][0]._handle) {
self.agent.sockets[socket][0]._handle.socket.end();
for (var i = 0, l = self.agent.sockets[socket].length; i < l; ++i) {
if (self.agent.sockets[socket][i]._handle) {
self.agent.sockets[socket][i]._handle.socket.end();
}
}
});
};
Expand Down

0 comments on commit f6c376d

Please sign in to comment.