]> Untitled Git - lemmy.git/commitdiff
Rate limit ws joins (#2171)
authorDessalines <dessalines@users.noreply.github.com>
Mon, 28 Mar 2022 20:31:35 +0000 (20:31 +0000)
committerGitHub <noreply@github.com>
Mon, 28 Mar 2022 20:31:35 +0000 (20:31 +0000)
* Removing async on mutex lock fn.

* Removing redundant ip

* Don't check rate limit twice.

crates/websocket/src/chat_server.rs

index d9de90dbef8c54d700f6651713cd169a3c850028..4dafafd8e3cf93a1f8f6565a8604f7964ea6f7fb 100644 (file)
@@ -485,7 +485,7 @@ impl ChatServer {
           UserOperationCrud::CreatePost => rate_limiter.post().check(ip),
           UserOperationCrud::CreateCommunity => rate_limiter.register().check(ip),
           UserOperationCrud::CreateComment => rate_limiter.comment().check(ip),
-          _ => rate_limiter.message().check(ip),
+          _ => true,
         };
         let fut = (message_handler_crud)(context, msg.id, user_operation_crud, data);
         (passed, fut)
@@ -493,7 +493,7 @@ impl ChatServer {
         let user_operation = UserOperation::from_str(op)?;
         let passed = match user_operation {
           UserOperation::GetCaptcha => rate_limiter.post().check(ip),
-          _ => rate_limiter.message().check(ip),
+          _ => true,
         };
         let fut = (message_handler)(context, msg.id, user_operation, data);
         (passed, fut)