summaryrefslogtreecommitdiff
path: root/packages/backend
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2024-08-17 09:30:03 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2024-08-17 09:30:03 +0900
commitd3cdc0880274bf90541a77812deff073ed05b1bc (patch)
tree8df39e8d7d6678847e5ffc76834b405624283a9e /packages/backend
parentUpdate timeline.vue (fix wrong type) (diff)
downloadsharkey-d3cdc0880274bf90541a77812deff073ed05b1bc.tar.gz
sharkey-d3cdc0880274bf90541a77812deff073ed05b1bc.tar.bz2
sharkey-d3cdc0880274bf90541a77812deff073ed05b1bc.zip
fix(backend): 無制限にストリーミングのチャンネルに接続できる問題を修正
Diffstat (limited to 'packages/backend')
-rw-r--r--packages/backend/src/server/api/stream/Connection.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/stream/Connection.ts b/packages/backend/src/server/api/stream/Connection.ts
index 7773150b74..0fb5238c78 100644
--- a/packages/backend/src/server/api/stream/Connection.ts
+++ b/packages/backend/src/server/api/stream/Connection.ts
@@ -20,6 +20,8 @@ import type { ChannelsService } from './ChannelsService.js';
import type { EventEmitter } from 'events';
import type Channel from './channel.js';
+const MAX_CHANNELS_PER_CONNECTION = 32;
+
/**
* Main stream connection
*/
@@ -255,6 +257,10 @@ export default class Connection {
*/
@bindThis
public connectChannel(id: string, params: JsonObject | undefined, channel: string, pong = false) {
+ if (this.channels.length >= MAX_CHANNELS_PER_CONNECTION) {
+ return;
+ }
+
const channelService = this.channelsService.getChannelService(channel);
if (channelService.requireCredential && this.user == null) {