Closed Removed-5an closed 10 years ago
I can remember that an error is triggered for both the socket as the req after a timeout, which would cause the cb to run twice. I need to test this first.
Agreed, I'm not sure on how you can "fake/replicate" a timeout, so I didn't try it out myself.
What I usually do is set the timeout to something like 10ms so that it is always triggered (my internet is not that quick). I can also do this soon myself.
On Tue, Mar 11, 2014 at 3:49 PM, 5an1ty notifications@github.com wrote:
Agreed, I'm not sure on how you can "fake/replicate" a timeout, so I didn't try it out myself.
Reply to this email directly or view it on GitHubhttps://github.com/askmike/bitstamp/pull/14#issuecomment-37303805 .
Oh that's smart! If you don't find the time, I'll try it out myself later on.
Hmm, when I try a low setTimeout I get the following error:
{ [Error: socket hang up] code: 'ECONNRESET' }
Not the same error that I had before: Error: connect ETIMEDOUT at errnoException (net.js:904:11) at Object.afterConnect as oncomplete
However adding:
socket.on('error', function(err){
callback(err);
});
Doesn't cause for a double callback, so we might as well have it in.
awesome thanks!
Needs to be verified if this actually catches the error and if it doesn't cause double callbacks.