General BanchoServer cleanup

This commit is contained in:
Holly Stubbs 2023-09-10 18:31:29 +01:00
parent 0d68b07e9c
commit 09dc1ffb76
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
2 changed files with 50 additions and 48 deletions

View file

@ -180,7 +180,6 @@ export default async function HandleRequest(req:IncomingMessage, res:ServerRespo
PacketUser.match?.setStateNotReady(PacketUser); PacketUser.match?.setStateNotReady(PacketUser);
break; break;
// TODO: Match leave so the matches actually close
case Packets.Client_PartMatch: case Packets.Client_PartMatch:
await PacketUser.match?.leaveMatch(PacketUser); await PacketUser.match?.leaveMatch(PacketUser);
break; break;
@ -274,12 +273,17 @@ export default async function HandleRequest(req:IncomingMessage, res:ServerRespo
break; break;
case Packets.Client_UserPresenceRequest: case Packets.Client_UserPresenceRequest:
UserPresence(PacketUser, PacketUser.id); // Can't really think of a way to generalize this? UserPresence(PacketUser, PacketUser.id);
break;
// Ignored packets
case Packets.Client_Pong:
case Packets.Client_BeatmapInfoRequest:
case Packets.Client_ReceiveUpdates:
break; break;
default: default:
// Ignore client_beatmapInfoRequest and client_receiveUpdates
if (CurrentPacket.id == 68 || CurrentPacket.id == 79 || CurrentPacket.id == 4) break;
// Print out unimplemented packet // Print out unimplemented packet
console.dir(CurrentPacket); console.dir(CurrentPacket);
break; break;
@ -290,7 +294,7 @@ export default async function HandleRequest(req:IncomingMessage, res:ServerRespo
PacketUser.clearQueue(); PacketUser.clearQueue();
} else { } else {
// User's token is invlid, force a reconnect // User's token is invlid, force a reconnect
ConsoleHelper.printBancho(`Forced client re-login (Token is invalid)`); ConsoleHelper.printBancho(`Forced client re-connect (Token is invalid)`);
const osuPacketWriter = osu.Bancho.Writer(); const osuPacketWriter = osu.Bancho.Writer();
osuPacketWriter.Announce("Reconnecting..."); osuPacketWriter.Announce("Reconnecting...");
osuPacketWriter.Restart(0); osuPacketWriter.Restart(0);

View file

@ -192,8 +192,6 @@ export default async function LoginProcess(req:IncomingMessage, res:ServerRespon
UserPresenceBundle(newUser); UserPresenceBundle(newUser);
osuPacketWriter.Announce(`Welcome back ${loginInfo.username}!`); osuPacketWriter.Announce(`Welcome back ${loginInfo.username}!`);
// TODO: Remove once merged into master
osuPacketWriter.Announce("Heads up!\nWhile the TypeScript server rewrite is mostly stable it still has some issues.");
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }