backend/gateway: enforce d
field to be a single numeric 0
for ping payloads
This commit is contained in:
parent
538717cfc9
commit
bf5e4f554e
1 changed files with 5 additions and 1 deletions
|
@ -216,7 +216,11 @@ export default function(server: Server) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GatewayPayloadType.Ping: {
|
case GatewayPayloadType.Ping: {
|
||||||
// TODO: also check session here and ensure packet is sent at the right time
|
if (payload.d !== 0) {
|
||||||
|
return closeWithBadPayload(ws, "d: expected numeric '0'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: also check session here
|
||||||
ws.state.alive = true;
|
ws.state.alive = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue