A socket's own error closes that socket, not the server
A message over the size limit or a malformed frame raised an error on the socket, which had no listener, and Node ended the process: one message from anyone could take the server down until systemd restarted it. The socket is terminated instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3a6b0ff43e
commit
a4196480ce
@@ -738,6 +738,8 @@ wss.on("connection", (socket, req) => {
|
||||
roomsCreated: 0, lastCatchUpAt: 0, hotseatReports: 0,
|
||||
};
|
||||
sessions.add(session);
|
||||
// A socket's own error (a frame over the limit, a malformed one) closes that socket, never the server.
|
||||
socket.on("error", () => socket.terminate());
|
||||
send(socket, { type: "welcome", game: "wizwar" });
|
||||
|
||||
socket.on("close", () => {
|
||||
|
||||
Reference in New Issue
Block a user