commit 84922ca09ac02aff429329f2c988282927b99285 parent d88a36962ba08d85dcf962ccf1691fc9ee81c3fe Author: n0tr1v <n0tr1v@protonmail.com> Date: Tue, 23 May 2023 23:39:28 -0700 add doc Diffstat:
| M | pkg/web/handlers/handlers.go | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4919,6 +4919,10 @@ const userMaxStream = 15 var ErrTooManyStreams = errors.New("too many streams") +// UsersStreamsManager ensure that a user doesn't have more than userMaxStream +// http long polling streams open at the same time. +// If the limit is reached, the pages will then refuse to load. +// This is to prevent a malicious user from opening unlimited amount of streams and wasting the server resources. type UsersStreamsManager struct { sync.Mutex m map[database.UserID]int64