mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Set a max subscriptions size per connection
This commit is contained in:
parent
a6b58b50cf
commit
f27609feb8
1 changed files with 5 additions and 0 deletions
|
|
@ -153,6 +153,11 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
|||
async function handleReq([_, subId, ...filters]: NostrClientREQ): Promise<void> {
|
||||
if (rateLimited(limiters.req)) return;
|
||||
|
||||
if (controllers.size > 20) {
|
||||
send(['CLOSED', subId, 'error: too many subscriptions']);
|
||||
return;
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
controllers.get(subId)?.abort();
|
||||
controllers.set(subId, controller);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue