From c7333fab42ca2c5901840a957e9caaaa227c9e9f Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Thu, 20 Dec 2018 18:15:49 -0800 Subject: [PATCH] fix for @mmalmi 's Identifi --- gun.js | 17 ++++++++--------- test/panic/b2s2s2b.js | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gun.js b/gun.js index 3c10479d..45c0bbfa 100644 --- a/gun.js +++ b/gun.js @@ -1385,7 +1385,7 @@ }); return gun; } - as.$ = gun = root.get(as.soul); + as.$ = root.get(as.soul); as.ref = as.$; ify(as); return gun; @@ -1540,8 +1540,8 @@ as.data = obj_put({}, at.get, as.data); }); } - tmp = tmp || at.get; - at = (at.root.$.get(tmp)._); + tmp = tmp || at.soul || at.link || at.dub;// || at.get; + at = tmp? (at.root.$.get(tmp)._) : at; as.soul = tmp; data = as.data; } @@ -1759,13 +1759,12 @@ var gun = this, soul; cb = cb || function(){}; opt = opt || {}; opt.item = opt.item || item; - if(soul = Gun.node.soul(item)){ return gun.set(gun.back(-1).get(soul), cb, opt) } + if(soul = Gun.node.soul(item)){ item = Gun.obj.put({}, soul, Gun.val.link.ify(soul)) } if(!Gun.is(item)){ - var id = gun.back('opt.uuid')(); - if(id && Gun.obj.is(item)){ - return gun.set(gun._.root.$.put(item, id), cb, opt); + if(Gun.obj.is(item)){; + item = gun.back(-1).get(soul = soul || Gun.node.soul(item) || gun.back('opt.uuid')()).put(item); } - return gun.get((Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt); + return gun.get(soul || (Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt); } item.get(function(soul, o, msg){ if(!soul){ return cb.call(gun, {err: Gun.log('Only a node can be linked! Not "' + msg.put + '"!')}) } @@ -2215,4 +2214,4 @@ var noop = function(){}; })(USE, './adapters/websocket'); -}()); +}()); \ No newline at end of file diff --git a/test/panic/b2s2s2b.js b/test/panic/b2s2s2b.js index 631c2f09..1b30bcda 100644 --- a/test/panic/b2s2s2b.js +++ b/test/panic/b2s2s2b.js @@ -3,8 +3,8 @@ var config = { port: 8765, servers: 2, browsers: 2, - each: 100000, - burst: 2, + each: 500, + burst: 50, wait: 1, notrad: true, route: {