mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
bump version
This commit is contained in:
parent
8f5ab18fa3
commit
14ebd73d80
2
gun.min.js
vendored
2
gun.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.2019.1211",
|
||||
"version": "0.2019.1228",
|
||||
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
|
||||
"main": "index.js",
|
||||
"browser": "gun.js",
|
||||
|
@ -19,14 +19,14 @@ function Mesh(root){
|
||||
if('[' === tmp){
|
||||
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
||||
if(!msg){ return }
|
||||
LOG && opt.log(msg.length, 'in hear batch');
|
||||
LOG && opt.log(+new Date, msg.length, 'in hear batch');
|
||||
(function go(){
|
||||
var S; LOG && (S = +new Date); // STATS!
|
||||
var m, c = 100; // hardcoded for now?
|
||||
while(c-- && (m = msg.shift())){
|
||||
mesh.hear(m, peer);
|
||||
}
|
||||
LOG && opt.log(+new Date - S, 'batch heard');
|
||||
LOG && opt.log(S, +new Date - S, 'batch heard');
|
||||
if(!msg.length){ return }
|
||||
puff(go, 0);
|
||||
}());
|
||||
@ -55,7 +55,7 @@ function Mesh(root){
|
||||
}
|
||||
var S; LOG && (S = +new Date);
|
||||
root.on('in', msg);
|
||||
LOG && !msg.nts && opt.log(+new Date - S, 'msg', msg['#']);
|
||||
LOG && !msg.nts && opt.log(S, +new Date - S, 'msg', msg['#']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ function Mesh(root){
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG && opt.log(+new Date - S, 'say prep');
|
||||
LOG && opt.log(S, +new Date - S, 'say prep');
|
||||
dup.track(id).it = msg; // track for 9 seconds, default. Earth<->Mars would need more!
|
||||
if(!peer){ peer = (tmp = dup.s[msg['@']]) && (tmp = tmp.it) && (tmp = tmp._) && (tmp = tmp.via) }
|
||||
if(!peer && mesh.way){ return mesh.way(msg) }
|
||||
@ -91,7 +91,7 @@ function Mesh(root){
|
||||
if(!Type.obj.is(peer || opt.peers)){ return false }
|
||||
var S; LOG && (S = +new Date);
|
||||
Type.obj.map(peer || opt.peers, each); // in case peer is a peer list.
|
||||
LOG && opt.log(+new Date - S, 'say loop');
|
||||
LOG && opt.log(S, +new Date - S, 'say loop');
|
||||
return;
|
||||
}
|
||||
if(!peer.wire && mesh.wire){ mesh.wire(peer) }
|
||||
@ -118,7 +118,7 @@ function Mesh(root){
|
||||
var S; LOG && (S = +new Date);
|
||||
try{tmp = (1 === tmp.length? tmp[0] : JSON.stringify(tmp));
|
||||
}catch(e){return opt.log('DAM JSON stringify error', e)}
|
||||
LOG && opt.log(+new Date - S, 'say stringify', tmp.length);
|
||||
LOG && opt.log(S, +new Date - S, 'say stringify', tmp.length);
|
||||
if(!tmp){ return }
|
||||
send(tmp, peer);
|
||||
}
|
||||
@ -135,7 +135,7 @@ function Mesh(root){
|
||||
if(wire.send){
|
||||
wire.send(raw);
|
||||
}
|
||||
LOG && opt.log(+new Date - S, 'wire send', raw.length);
|
||||
LOG && opt.log(S, +new Date - S, 'wire send', raw.length);
|
||||
mesh.say.d += raw.length||0; ++mesh.say.c; // STATS!
|
||||
}catch(e){
|
||||
(peer.queue = peer.queue || []).push(raw);
|
||||
@ -171,7 +171,8 @@ function Mesh(root){
|
||||
opt.peers[peer.url || peer.id] = peer;
|
||||
} else {
|
||||
tmp = peer.id = peer.id || Type.text.random(9);
|
||||
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
||||
mesh.say({dam: '?', pid: root.opt.pid}, opt.peers[tmp] = peer);
|
||||
delete dup.s[peer.last]; // IMPORTANT: see https://gun.eco/docs/DAM#self
|
||||
}
|
||||
peer.met = peer.met || +(new Date);
|
||||
if(!tmp.hied){ root.on(tmp.hied = 'hi', peer) }
|
||||
@ -189,18 +190,12 @@ function Mesh(root){
|
||||
}
|
||||
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
||||
mesh.hear['?'] = function(msg, peer){
|
||||
if(!msg.pid){
|
||||
mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer);
|
||||
// @rogowski I want to re-enable this AXE logic with some fix/merge later.
|
||||
/* var tmp = peer.queue; peer.queue = [];
|
||||
Type.obj.map(tmp, function(msg){
|
||||
mesh.say(msg, peer);
|
||||
}); */
|
||||
// @rogowski 2: I think with my PID fix we can delete this and use the original.
|
||||
return;
|
||||
if(msg.pid){
|
||||
if(!peer.pid){ peer.pid = msg.pid }
|
||||
if(msg['@']){ return }
|
||||
}
|
||||
if(peer.pid){ return }
|
||||
peer.pid = msg.pid;
|
||||
mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer);
|
||||
delete dup.s[peer.last]; // IMPORTANT: see https://gun.eco/docs/DAM#self
|
||||
}
|
||||
|
||||
root.on('create', function(root){
|
||||
|
@ -34,7 +34,7 @@ function output(msg){
|
||||
if(obj_has(back, 'put')){
|
||||
back.on('in', back);
|
||||
}
|
||||
if(tmp){ return }
|
||||
if(tmp && u !== back.put){ return } //if(tmp){ return }
|
||||
msg.$ = back.$;
|
||||
} else
|
||||
if(obj_has(back.put, get)){ // TODO: support #LEX !
|
||||
@ -247,7 +247,7 @@ function not(at, msg){
|
||||
if(u === tmp && u !== at.put){ return true }
|
||||
neat.put = u;
|
||||
if(neat.ack){
|
||||
neat.ack = -1; // TODO: BUG? Should this be 0?
|
||||
neat.ack = -1; // Shouldn't this be reset to 0? If we do that, SEA test `set user ref should be found` fails, odd.
|
||||
}
|
||||
neat.on('in', {
|
||||
get: key,
|
||||
|
Loading…
x
Reference in New Issue
Block a user