Address reviews

pull/317/head
sachaaaaa 6 years ago
parent 6a06e05452
commit 03e7fb82e6

@ -16,17 +16,12 @@ class LocalLokiServer extends EventEmitter {
* Creates an instance of LocalLokiServer. * Creates an instance of LocalLokiServer.
* Sends out a `message` event when a new message is received. * Sends out a `message` event when a new message is received.
*/ */
constructor(pems, options) { constructor(pems, options = {}) {
super(); super();
const httpsOptions = { const httpsOptions = {
key: pems.private, key: pems.private,
cert: pems.cert, cert: pems.cert,
}; };
// eslint-disable-next-line no-param-reassign
options = {
skipUpnp: false,
...options,
};
if (!options.skipUpnp) { if (!options.skipUpnp) {
this.upnpClient = natUpnp.createClient(); this.upnpClient = natUpnp.createClient();
} }
@ -101,8 +96,9 @@ class LocalLokiServer extends EventEmitter {
const publicPort = await this.punchHole(); const publicPort = await this.punchHole();
res(publicPort); res(publicPort);
} catch (e) { } catch (e) {
if (e instanceof textsecure.HolePunchingError) if (e instanceof textsecure.HolePunchingError) {
await this.close(); await this.close();
}
rej(e); rej(e);
} }
} else { } else {

Loading…
Cancel
Save