node-modules / agentkeepalive

Support keepalive http agent.
MIT License
579 stars 57 forks source link

Fix off-by-one error counting maxSockets. #10

Closed jsha closed 10 years ago

fengmk2 commented 10 years ago

@jsha maybe you also need to fix this on joyent/node

fengmk2 commented 10 years ago

This bug had been fixed on master branch.

// console.log(count, freeLen, self.maxSockets, self.maxFreeSockets)
        if (count > self.maxSockets || freeLen >= self.maxFreeSockets) {
          // console.log('hit max sockets', count, freeLen, self.maxSockets, self.maxFreeSockets);
          self.removeSocket(socket, options);
          socket.destroy();
        }
fengmk2 commented 10 years ago

Check https://github.com/node-modules/agentkeepalive/blob/master/lib/_http_agent.js#L94 out