Fixes behavior on hangups and aborts
The existing behavior on hangups and aborts disregarded the parameters passed in via options, and failed at a number smaller than maxRetries. This is counter intuitive, undocumented, and not modifiable from the external API. This pull request defaults maxHangups and maxAborts to maxRetries and changes the underlying code to actually use those values rather than hard coded values.
Update maxSockets in README to match the code
In the code, the default is 20, not 200.
Added facilities for adding and removing nodes from the pool
For v0.10 we need to check `req.timedOut` in `gotEnd()` to know that we aborted, and this is not a complete response.
Add an `EndpointError` class.
Third-party libraries and Node's domains (via `domain.bind` and `domain.intercept`) may assume that error objects inherit from `Error`.
… the timing event. Fixes #10
when the filtered counter was added I failed to account for it in setPending and resetCounters. This caused the pending count to not be calculated correctly, it was exactly filtered count too large. In the future it may be better to use a single counter for pending that is incremented on 'request' and decremeted on 'complete'
rewrote the ping logic to fix several ping related issues
The previous code would ping too frequently and could get stuck in a ping loop, even if the endpoint was actually healthy. The new code factors out the ping logic into its own module. The logic for setting the endpoint health has be constrained to exactly two locations, one for setting as healthy and one for unhealthy. Pinger ensures that only one ping request is pending at a given time and that the ping loop is independent of other timeouts. The pinger uses exponential backoff for timing ping requests with a maximum delay of 10s. The tests were updated for the new behavior.