From b837bfcbc387282fc8c0d75abba98b37cb4ac4af Mon Sep 17 00:00:00 2001 From: holly Date: Wed, 22 Sep 2021 19:17:11 +0100 Subject: [PATCH] don't Buffer.alloc for every single request --- server/serverHandler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/serverHandler.js b/server/serverHandler.js index 2b6e7fd..e59d05d 100644 --- a/server/serverHandler.js +++ b/server/serverHandler.js @@ -131,6 +131,8 @@ const ChangeAction = require("./Packets/ChangeAction.js"), TourneyMatchJoinChannel = require("./Packets/TourneyMatchSpecialInfo.js"), TourneyMatchLeaveChannel = require("./Packets/TourneyLeaveMatchChannel.js"); +const emptyBuffer = Buffer.alloc(0); + // A class for managing everything multiplayer global.MultiplayerManager = new MultiplayerManager(); @@ -143,7 +145,7 @@ module.exports = async function(req, res) { requestData = req.packet; // Server's response & new client token - let responseData = new Buffer.alloc(0); + let responseData = emptyBuffer; // Check if the user is logged in if (requestTokenString == null) {