Impliment user auth on server

This commit is contained in:
derek.holloway committed 2026-08-04 08:55:33 -07:00
1 parent 007f87f986
commit 974b5c4f0a
2 files changed
+29 -14

No files matched your search

+9 -7
View File
@@ -49,21 +49,23 @@ namespace Mistox.Server {
onUserConnected?.Invoke( user );
}
public event Action<dynamic> onDataReceived;
public event Action<ServerConnection, dynamic> onDataReceived;
public void InvokeDataReceived( ServerConnection user, dynamic data ){
switch (data as object) {
case UserAuthPacket packet:
Task.Run(async () => {
try {
await ProcessAuthRequest(user, packet);
} catch {}
});
if (!user.IsAuthenticated) {
Task.Run(async () => {
try {
await ProcessAuthRequest(user, packet);
} catch {}
});
}
break;
case null:
Console.WriteLine("Received a null packet.");
break;
default:
onDataReceived?.Invoke(data);
onDataReceived?.Invoke(user, data);
break;
}
}