Send hp error to olm

This commit is contained in:
Owen
2026-06-01 13:57:54 -07:00
parent d11a244caa
commit 09b2671759
2 changed files with 9 additions and 0 deletions

View File

@@ -1,4 +1,8 @@
import { sendToClient } from "#dynamic/routers/ws";
import config from "@server/lib/config";
const udpPort = config.getRawConfig().gerbil.clients_start_port;
// Error codes for registration failures
export const OlmErrorCodes = {
OLM_NOT_FOUND: {
@@ -86,6 +90,10 @@ export const OlmErrorCodes = {
TERMINATED_BLOCKED: {
code: "TERMINATED_BLOCKED",
message: "This session was terminated because access was blocked."
},
HOLEPUNCH_MISSING: {
code: "HOLEPUNCH_MISSING",
message: `Hole punch information is missing. Please ensure your client can reach the server on UDP port ${udpPort} and try registering again.`
}
} as const;

View File

@@ -327,6 +327,7 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
`[handleOlmRegisterMessage] Client last hole punch is too old and we have sites to send; skipping this register. The client is failing to hole punch and identify its network address with the server. Can the client reach the server on UDP port ${config.getRawConfig().gerbil.clients_start_port}?`,
{ orgId: client.orgId, clientId: client.clientId }
);
sendOlmError(OlmErrorCodes.HOLEPUNCH_MISSING, olm.olmId);
return;
}