Removed forceP2p as argument for the pingContact event and enforced it on the other side

pull/175/head
Beaudan 6 years ago
parent 02d6920ade
commit cde7bbf3c3

@ -222,10 +222,10 @@
window.lokiP2pAPI = new window.LokiP2pAPI( window.lokiP2pAPI = new window.LokiP2pAPI(
textsecure.storage.user.getNumber() textsecure.storage.user.getNumber()
); );
window.lokiP2pAPI.on( window.lokiP2pAPI.on('pingContact', pubKey => {
'pingContact', const forceP2p = true;
window.libloki.api.sendOnlineBroadcastMessage window.libloki.api.sendOnlineBroadcastMessage(pubKey, forceP2p);
); });
// These make key operations available to IPC handlers created in preload.js // These make key operations available to IPC handlers created in preload.js
window.Events = { window.Events = {

@ -80,7 +80,7 @@ class LokiP2pAPI extends EventEmitter {
if (!this.contactP2pDetails[pubKey]) { if (!this.contactP2pDetails[pubKey]) {
return; return;
} }
this.emit('pingContact', pubKey, true); this.emit('pingContact', pubKey);
} }
} }

@ -44,8 +44,7 @@ describe('LocalLokiServer', () => {
const timer = setTimeout(() => { const timer = setTimeout(() => {
promise = Promise.resolve(); promise = Promise.resolve();
}, 5000); }, 5000);
this.lokiP2pAPI.on('pingContact', (pubKey, forceP2p) => { this.lokiP2pAPI.on('pingContact', pubKey => {
assert.isTrue(forceP2p);
clearTimeout(timer); clearTimeout(timer);
promise = Promise.resolve(pubKey); promise = Promise.resolve(pubKey);
}); });

Loading…
Cancel
Save