From f3e5cebe45981c344f2bf1fbf95448f90d9c8a52 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 16 Apr 2023 17:17:49 -0400 Subject: [PATCH] *update dist --- dist/proxies/multiSocket.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/proxies/multiSocket.js b/dist/proxies/multiSocket.js index 58666eb..6e59b25 100644 --- a/dist/proxies/multiSocket.js +++ b/dist/proxies/multiSocket.js @@ -164,17 +164,19 @@ class MultiSocketProxy extends proxy_js_1.default { decode: this._server ? compact_encoding_1.json.decode : socketEncoding.decode, }, async onmessage(m) { - if (self._allowedPorts.length && - !self._allowedPorts.includes(m.port)) { - self.get(await self._getPublicKey(peer)).messages.errorSocket.send({ - id: m.id, - err: new Error(`port ${m.port} not allowed`), - }); - return; + if (self._server) { + if (self._allowedPorts.length && + !self._allowedPorts.includes(m.port)) { + self.get(await self._getPublicKey(peer)).messages.errorSocket.send({ + id: m.id, + err: new Error(`port ${m.port} not allowed`), + }); + return; + } } m = m; if (self._server) { - new self.socketClass(nextSocketId(), m, self, self.get(await self._getPublicKey(peer)), m).connect(); + new self.socketClass(nextSocketId(), m.id, self, self.get(await self._getPublicKey(peer)), m).connect(); return; } const socket = self._sockets.get(m.id);