Fix policy bug

This commit is contained in:
Jon Staab
2025-04-11 14:54:39 -07:00
parent f200fe1a42
commit b6b54f650b
+2 -2
View File
@@ -1,4 +1,4 @@
import {on, nthEq, always, call, sleep, ago, now} from "@welshman/lib"
import {on, nthNe, always, call, sleep, ago, now} from "@welshman/lib"
import {AUTH_JOIN, StampedEvent, SignedEvent} from "@welshman/util"
import {
ClientMessage,
@@ -42,7 +42,7 @@ export const socketPolicyAuthBuffer = (socket: Socket) => {
// If the client is closing a req, remove both from our buffer
// Otherwise, if auth isn't done, hang on to recent messages in case we need to replay them
if (isClientClose(message) || isClientNegClose(message)) {
buffer = buffer.filter(nthEq(1, message[1]))
buffer = buffer.filter(nthNe(1, message[1]))
} else {
buffer = buffer.slice(-50).concat([message])
}