From 18827528391917e40f06087a37dc4cd11dd9c9df Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 16 Apr 2023 07:09:09 -0400 Subject: [PATCH] * Add await keyword to multiSocket.ts to await for message to be added to the peer channel. --- src/proxies/multiSocket.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/proxies/multiSocket.ts b/src/proxies/multiSocket.ts index 85064b6..f4a44fe 100644 --- a/src/proxies/multiSocket.ts +++ b/src/proxies/multiSocket.ts @@ -189,7 +189,7 @@ export default class MultiSocketProxy extends Proxy { private async _registerOpenSocketMessage(peer: Peer) { const self = this; - const message = peer.channel.addMessage({ + const message = await peer.channel.addMessage({ encoding: { preencode: json.preencode, encode: json.encode, @@ -237,7 +237,7 @@ export default class MultiSocketProxy extends Proxy { private async _registerWriteSocketMessage(peer: Peer) { const self = this; - const message = peer.channel.addMessage({ + const message = await peer.channel.addMessage({ encoding: writeSocketEncoding, onmessage(m: WriteSocketRequest) { self._sockets.get(m.id)?.push(m.data); @@ -250,7 +250,7 @@ export default class MultiSocketProxy extends Proxy { private async _registerCloseSocketMessage(peer: Peer) { const self = this; - const message = peer.channel.addMessage({ + const message = await peer.channel.addMessage({ encoding: socketEncoding, onmessage(m: CloseSocketRequest) { self._sockets.get(m.id)?.end(); @@ -263,7 +263,7 @@ export default class MultiSocketProxy extends Proxy { private async _registerTimeoutSocketMessage(peer: Peer) { const self = this; - const message = peer.channel.addMessage({ + const message = await peer.channel.addMessage({ encoding: socketEncoding, onmessage(m: SocketRequest) { // @ts-ignore @@ -277,7 +277,7 @@ export default class MultiSocketProxy extends Proxy { private async _registerErrorSocketMessage(peer: Peer) { const self = this; - const message = peer.channel.addMessage({ + const message = await peer.channel.addMessage({ encoding: errorSocketEncoding, onmessage(m: ErrorSocketRequest) { // @ts-ignore