nodejs fixes, some tmp

This commit is contained in:
Mark Nadal 2020-05-16 01:33:41 -07:00
parent 880947afe8
commit 49bc20ee95
2 changed files with 8 additions and 4 deletions

7
gun.js
View File

@ -1418,7 +1418,7 @@
if(cat.jam){ return cat.jam.push([cb, as]) }
cat.jam = [[cb,as]];
gun.get(function go(msg, eve){
if(u === msg.put && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){
if(u === msg.put && !cat.root.opt.super && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){ // TODO: super should not be in core code, bring AXE up into core instead to fix?
return;
}
eve.rid(msg);
@ -1819,9 +1819,10 @@
}
if((tmp = eve.wait) && (tmp = tmp[at.id])){ clearTimeout(tmp) }
eve.ack = (eve.ack||0)+1;
if(!to && u === data && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return }
// TODO: super should not be in core code, bring AXE up into core instead to fix?
if(!to && u === data && !at.root.opt.super && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return }
if((!to && (u === data || at.soul || at.link || (link && !(0 < link.ack))))
|| (u === data && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){
|| (u === data && !at.root.opt.super && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){
tmp = (eve.wait = {})[at.id] = setTimeout(function(){
val.call({as:opt}, msg, eve, tmp || 1);
}, opt.wait || 99);

View File

@ -62,7 +62,10 @@ Gun.on('opt', function(root){
var ws = opt.ws = opt.ws || {};
ws.path = ws.path || '/gun';
// if we DO need an HTTP server, then choose ws specific one or GUN default one.
if(!ws.noServer){ ws.server = ws.server || opt.web }
if(!ws.noServer){
ws.server = ws.server || opt.web;
if(!ws.server){ return }
}
ws.web = ws.web || new opt.WebSocket.Server(ws); // we still need a WS server.
ws.web.on('connection', function(wire){ var peer;
wire.upgradeReq = wire.upgradeReq || {};