manager: fix reconnect attempts start

This commit is contained in:
Guillermo Rauch
2012-12-24 20:39:28 -03:00
parent 558f8b2626
commit c3a04f704b

View File

@@ -41,6 +41,7 @@ function Manager(socket, opts){
if (!socket || !socket.write) socket = eio(socket, opts);
this.engine = socket;
this.connected = 0;
this.attempts = 0;
this.open();
}
@@ -319,9 +320,9 @@ Manager.prototype.reconnect = function(){
this.emit('reconnect_failed');
this.reconnecting = false;
} else {
var delay = this.attempts * this._reconnectionDelay;
delay = Math.min(delay, this._reconnectionDelayMax);
debug('will wait %d before reconnect attempt', delay);
var delay = this.attempts * this.reconnectionDelay();
delay = Math.min(delay, this.reconnectionDelayMax());
debug('will wait %dms before reconnect attempt', delay);
this.reconnecting = true;
var timer = setTimeout(function(){