mirror of
https://github.com/amark/gun.git
synced 2025-07-03 03:12:32 +00:00
Revert changes in gun to solve peer.id undefined. Don't need this change now because we are not using the peer.id in the subscriptions. Maybe will add this in the future.
This commit is contained in:
parent
dd3d4c3066
commit
a6f12af8da
15
gun.js
15
gun.js
@ -2119,10 +2119,10 @@
|
|||||||
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
||||||
}
|
}
|
||||||
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
||||||
// tmp = peer.queue; peer.queue = [];
|
tmp = peer.queue; peer.queue = [];
|
||||||
// Type.obj.map(tmp, function(msg){
|
Type.obj.map(tmp, function(msg){
|
||||||
// mesh.say(msg, peer);
|
mesh.say(msg, peer);
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
mesh.bye = function(peer){
|
mesh.bye = function(peer){
|
||||||
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
||||||
@ -2132,12 +2132,7 @@
|
|||||||
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
||||||
mesh.hear['?'] = function(msg, peer){
|
mesh.hear['?'] = function(msg, peer){
|
||||||
if(!msg.pid){
|
if(!msg.pid){
|
||||||
mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer)
|
return mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer);
|
||||||
var tmp = peer.queue; peer.queue = [];
|
|
||||||
Type.obj.map(tmp, function(msg){
|
|
||||||
mesh.say(msg, peer);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
peer.id = peer.id || msg.pid;
|
peer.id = peer.id || msg.pid;
|
||||||
mesh.hi(peer);
|
mesh.hi(peer);
|
||||||
|
@ -193,10 +193,10 @@ function Mesh(ctx){
|
|||||||
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
mesh.say({dam: '?'}, opt.peers[tmp] = peer);
|
||||||
}
|
}
|
||||||
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
if(!tmp.hied){ ctx.on(tmp.hied = 'hi', peer) }
|
||||||
// tmp = peer.queue; peer.queue = [];
|
tmp = peer.queue; peer.queue = [];
|
||||||
// Type.obj.map(tmp, function(msg){
|
Type.obj.map(tmp, function(msg){
|
||||||
// mesh.say(msg, peer);
|
mesh.say(msg, peer);
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
mesh.bye = function(peer){
|
mesh.bye = function(peer){
|
||||||
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
Type.obj.del(opt.peers, peer.id); // assume if peer.url then reconnect
|
||||||
@ -206,12 +206,7 @@ function Mesh(ctx){
|
|||||||
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
mesh.hear['!'] = function(msg, peer){ opt.log('Error:', msg.err) }
|
||||||
mesh.hear['?'] = function(msg, peer){
|
mesh.hear['?'] = function(msg, peer){
|
||||||
if(!msg.pid){
|
if(!msg.pid){
|
||||||
mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer)
|
return mesh.say({dam: '?', pid: opt.pid, '@': msg['#']}, peer);
|
||||||
var tmp = peer.queue; peer.queue = [];
|
|
||||||
Type.obj.map(tmp, function(msg){
|
|
||||||
mesh.say(msg, peer);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
peer.id = peer.id || msg.pid;
|
peer.id = peer.id || msg.pid;
|
||||||
mesh.hi(peer);
|
mesh.hi(peer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user