Fix an infinite loop on connection error (this fixes issue #3) #4

Merged
merged 1 commit into from Jun 23, 2014

Projects

None yet

2 participants

@zorun
zorun commented Jun 23, 2014

Sometimes, an error happens on the socket, but the 'close' event is called
with "had_errors" set to False. In this case, we would could ourselves
recursively twice, which leads to an exponential number of recursive
calls over time.

This happens, for instance, when DNS resolution fails.

According to the doc, we only need to handle the 'close' event:

http://nodejs.org/api/net.html#net_event_error_1

Baptiste Jonglez Fix an infinite loop on connection error (this fixes issue #3)
Sometimes, an error happens on the socket, but the 'close' event is called
with "had_errors" set to False.  In this case, we would could ourselves
recursively *twice*, which leads to an exponential number of recursive
calls over time.

This happens, for instance, when DNS resolution fails.

According to the doc, we only need to handle the 'close' event:

  http://nodejs.org/api/net.html#net_event_error_1
c1867eb
@kerneis kerneis merged commit b5a55b0 into kerneis:develop Jun 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment