Skip to content
Browse files

When you disconnect before the connection timeout is called, you will…

… create a flood

of unaccepted messages
  • Loading branch information...
1 parent 7f6382d commit 4028c21d57ea6dfe389a95b6030a201211a70555 @3rd-Eden 3rd-Eden committed Jul 10, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/socket.js
View
11 lib/socket.js
@@ -241,9 +241,12 @@
}
connect();
- if (fn && typeof fn == 'function') {
- self.once('connect', fn);
- }
+
+ self.once('connect', function (){
+ clearTimeout(self.connectTimeoutTimer);
+
+ fn && typeof fn == 'function' && fn();
+ });
});
return this;
@@ -386,7 +389,7 @@
Socket.prototype.onError = function (err) {
if (err && err.advice) {
- if (err.advice === 'reconnect') {
+ if (err.advice === 'reconnect' && this.connected) {
this.disconnect();
this.reconnect();
}

0 comments on commit 4028c21

Please sign in to comment.
Something went wrong with that request. Please try again.