mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
fix #263 for @imomin and limit back off
This commit is contained in:
parent
30b4aaa6f7
commit
fe624166cc
6
gun.js
6
gun.js
@ -1366,7 +1366,7 @@
|
||||
while(i--){ (r.createServer.s[i] || function(){})(req, cb) }
|
||||
}
|
||||
r.createServer.s = [];
|
||||
r.back = 2; r.backoff = 2;
|
||||
r.back = 2; r.backoff = 2; r.backmax = 2000;
|
||||
r.transport = function(opt, cb){
|
||||
//Gun.log("TRANSPORT:", opt);
|
||||
if(r.ws(opt, cb)){ return }
|
||||
@ -1423,7 +1423,7 @@
|
||||
ws.onopen = function(o){
|
||||
|
||||
// Send the queued messages.
|
||||
Gun.obj.map(queue, function (deferred) {
|
||||
r.each(queue, function (deferred) {
|
||||
r.ws.apply(null, deferred);
|
||||
});
|
||||
|
||||
@ -1445,7 +1445,7 @@
|
||||
ws = r.ws.peers[opt.base] = null; // this will make the next request try to reconnect
|
||||
setTimeout(function(){
|
||||
r.ws(opt, function(){}); // opt here is a race condition, is it not? Does this matter?
|
||||
}, r.back *= r.backoff);
|
||||
}, (r.back *= r.backoff) > r.backmax ? (r.back = r.backmax) : r.back);
|
||||
};
|
||||
if(typeof window !== "undefined"){ window.onbeforeunload = ws.onclose; }
|
||||
ws.onmessage = function(m){
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.3.999",
|
||||
"version": "0.3.9991",
|
||||
"description": "Graph engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user