197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
-
-
+
+
-
+
-
+
-
|
tidPoller: undefined /* poller timer */,
$initialDelay: 1000 /* initial polling interval (ms) */,
currentDelay: 1000 /* current polling interval */,
maxDelay: 60000 /* max interval when backing off for
connection errors */,
minDelay: 5000 /* minimum delay time */,
tidReconnect: undefined /*timer id for reconnection determination*/,
randomInterval: function(){
return Math.floor(Math.random() * this.minDelay);
randomInterval: function(factor){
return Math.floor(Math.random() * factor);
},
incrDelay: function(){
if( this.maxDelay > this.currentDelay ){
if(this.currentDelay < this.minDelay){
this.currentDelay = this.minDelay;
this.currentDelay = this.minDelay + this.randomInterval(this.minDelay/2);
}else{
this.currentDelay *= 2;
this.currentDelay = this.currentDelay*2 + this.randomInterval(this.currentDelay/2);
}
this.currentDelay += this.randomInterval();
}
return this.currentDelay;
},
resetDelay: function(){
return this.currentDelay = this.$initialDelay;
},
isDelayed: function(){
|