Testing passing.

`npm run testaxe`

Dont repeat rtc.nnounce.
This commit is contained in:
Adriano Rogowski 2019-04-10 21:15:27 -03:00
parent ed509d0ae3
commit d3f0d326b2
2 changed files with 3 additions and 1 deletions

3
axe.js
View File

@ -181,7 +181,8 @@
dht(soul, pids);
Gun.obj.map(pids.split(','), function(pid) {
/// TODO: here we can put an algorithm of who must connect?
if (!pid || pid in opt.peers || pid === opt.pid) { return; }
if (!pid || pid in opt.peers || pid === opt.pid || opt.announce[pid]) { return; }
opt.announce[pid] = true; /// To try only one connection to the same peer.
opt.announce(pid);
});
});

View File

@ -49,6 +49,7 @@
function open(msg){
var rtc = msg.rtc, peer, tmp;
if(!rtc || !rtc.id){ return }
delete opt.announce[rtc.id]; /// remove after connect
if(tmp = rtc.answer){
if(!(peer = opt.peers[rtc.id]) || peer.remoteSet){ return }
return peer.setRemoteDescription(peer.remoteSet = new opt.RTCSessionDescription(tmp));