joyent/node — pull request #8135 by fengmk2 (2014-08-11 16:15:39+00:00)
Title: http: add agent.keepAliveTimeout option

Eanble to set a timeout for the free keep-alive sockets.

* Remote server won't keep the free socket alive forever. After some timeout seconds, e.g. `30s`, the server close the socket. At the same time, if reuse this closing socket, will cause 'socket hangup' error. So we need to close the free socket before the server close it.

* And the `FIN` packet sent by server maybe lost too, then the client socket won't receive the `FIN` packet and it won't emit `close` event. So we need a free socket timeout to help us cleanup the zombie sockets.

Fixed joyent/node#6486