From c11089d371a02c7978bdebd3e8a531a0025dd772 Mon Sep 17 00:00:00 2001 From: Govorunb Date: Wed, 12 Jun 2024 16:49:50 +1000 Subject: [PATCH] polish --- ebs/src/modules/game/connection.ts | 8 ++++++-- ebs/src/modules/transactions.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ebs/src/modules/game/connection.ts b/ebs/src/modules/game/connection.ts index 6589e2f..f9bbb43 100644 --- a/ebs/src/modules/game/connection.ts +++ b/ebs/src/modules/game/connection.ts @@ -41,7 +41,8 @@ export class GameConnection { console.error("Could not parse message" + msgText); return; } - console.log(`Got message ${JSON.stringify(msg)}`); + if (msg.messageType !== MessageType.Ping) + console.log(`Got message ${JSON.stringify(msg)}`); this.processMessage(msg); }); ws.on("close", (code, reason) => { @@ -102,7 +103,7 @@ export class GameConnection { if (err) console.error(err); }); - if (msg.messageType !== MessageType.Ping) + if (msg.messageType !== MessageType.Pong) console.debug(`Sent message ${JSON.stringify(msg)}`); } public makeMessage(type: MessageType, guid?: string): Message { @@ -118,6 +119,7 @@ export class GameConnection { new Promise((resolve, reject) => { if (!transactionId) { reject(`Tried to redeem without transaction ID`); + return; } const msg: RedeemMessage = { @@ -132,11 +134,13 @@ export class GameConnection { } as RedeemMessage; if (this.outstandingRedeems.has(msg.guid)) { reject(`Redeeming ${msg.guid} more than once`); + return; } this.outstandingRedeems.set(msg.guid, msg); if (!this.isConnected()) { reject(`Redeemed without active connection`); + return; } this.resultHandlers.set(msg.guid, resolve); diff --git a/ebs/src/modules/transactions.ts b/ebs/src/modules/transactions.ts index 67757fc..64e98c1 100644 --- a/ebs/src/modules/transactions.ts +++ b/ebs/src/modules/transactions.ts @@ -284,7 +284,7 @@ app.post("/public/transaction", async (req, res) => { } ] }).then(); - res.status(500).send(`Failed to redeem - ${error}`); + res.status(500).send(`Failed to process redeem - ${error}`); } });