mongodb/node-mongodb-native — pull request #833 by aheckmann (2013-01-05 05:23:19+00:00)
Title: fix connection leak (gh-827)

When a Connection emitted `timeout` or `error` before `connect` it was never properly closed. As "High Availability" pings are triggered, each opening another connection to each node in the set, and each with its own pool set to the default (5), timeout errors in particular begin stacking up causing all sorts of sadness.

1) We now close the connection when a timeout or error event is emitted
2) We changed the HA pings connection pool size to 1 as 5 was superflous
3) Refactored a bit along the way