* Add await keyword to multiSocket.ts to await for message to be added to the peer channel.

This commit is contained in:
Derrick Hammer 2023-04-16 07:09:09 -04:00
parent 9791e7c4a1
commit 1882752839
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 5 deletions

View File

@ -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