From f7d9089ba74ed3dbf3496dbb45ee1b01cbcdda23 Mon Sep 17 00:00:00 2001 From: Yusuke Sano Date: Sun, 21 Apr 2019 17:45:39 +0900 Subject: [PATCH] bye.js fix (support new mesh) I am using gundb 0.8.1 0.2019.331 and noticed not working bye method when programming web application on this version. Maybe this is happened because bye() access to outdated mesh structure. --- lib/bye.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bye.js b/lib/bye.js index 776e6d4f..a7fa5c0d 100644 --- a/lib/bye.js +++ b/lib/bye.js @@ -5,8 +5,8 @@ Gun.on('opt', function(root){ if(root.once){ return } root.on('in', function(msg){ //Msg did not have a peer property saved before, so nothing ever went further - if(!msg.mesh || !msg.BYE){ return this.to.next(msg) } - var peer = msg.mesh.via; + if(!msg._ || !msg.BYE){ return this.to.next(msg) } + var peer = msg._.via; (peer.bye = peer.bye || []).push(msg.BYE); }) root.on('bye', function(peer){