Permalink
Browse files

Merge pull request #234 from 3rd-Eden/flood

When you disconnect before the connection timeout is called, you will cre
  • Loading branch information...
2 parents 0babfeb + 4028c21 commit c2741873648be5923cd53ec60e0262a503387fca @rauchg rauchg committed Jul 10, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/socket.js
View
@@ -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 c274187

Please sign in to comment.