summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-01-22 21:53:02 +0500
committerilotterytea <iltsu@alright.party>2025-01-22 21:54:32 +0500
commit9136ee6347c86b6b64ff044656b17f180d84f115 (patch)
tree8cb2096a8ac0ee4a5e9b5aaac053dde7e60deea7
parent04dbf81a0279cd9907386de3e5b0243cf44838c1 (diff)
upd: this retarded library sometimes fails to deserialize a message (temporary fix)
-rw-r--r--server/src/main/java/kz/ilotterytea/frogartha/server/FrogarthaServer.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/src/main/java/kz/ilotterytea/frogartha/server/FrogarthaServer.java b/server/src/main/java/kz/ilotterytea/frogartha/server/FrogarthaServer.java
index 1b0058b..99847df 100644
--- a/server/src/main/java/kz/ilotterytea/frogartha/server/FrogarthaServer.java
+++ b/server/src/main/java/kz/ilotterytea/frogartha/server/FrogarthaServer.java
@@ -1,5 +1,6 @@
package kz.ilotterytea.frogartha.server;
+import com.github.czyzby.websocket.serialization.SerializationException;
import com.github.czyzby.websocket.serialization.impl.ManualSerializer;
import kz.ilotterytea.frogartha.domain.Identity;
import kz.ilotterytea.frogartha.domain.actions.ChangedDirectionAction;
@@ -105,6 +106,10 @@ public class FrogarthaServer extends WebSocketServer {
}
} catch (PlayerKickException e) {
kickConnection(player, e);
+ } catch (SerializationException e) {
+ // FIXME: we should kick players for bad byte arrays
+ // but this library is kinda retarded, and it sometimes fails to deserialize a normal message
+ log.error("Failed to deserialize message by " + player, e);
} catch (Exception e) {
log.error("An exception was thrown while processing message", e);
kickConnection(player, PlayerKickException.internalServerError());