fixes lol
All checks were successful
Build and Push / build-all (push) Successful in 9m32s

This commit is contained in:
doomtube 2026-01-07 16:27:43 -05:00
parent c2bfa06faa
commit a56ca40204
16 changed files with 816 additions and 234 deletions

View file

@ -464,9 +464,24 @@ void ChatWebSocketController::handleChatMessage(const WebSocketConnectionPtr& ws
selfDestructSeconds = 300;
}
// Get connection info first to check if guest
ConnectionInfo currentInfo;
{
std::lock_guard<std::mutex> lock(connectionsMutex_);
auto it = connections_.find(wsConnPtr);
if (it == connections_.end()) {
return;
}
currentInfo = it->second;
}
// Guests cannot send self-destructing messages
if (currentInfo.isGuest && selfDestructSeconds > 0) {
selfDestructSeconds = 0;
}
// Re-fetch current connection info to prevent TOCTOU race conditions
// (user could have been banned/disconnected since the initial copy)
ConnectionInfo currentInfo;
{
std::lock_guard<std::mutex> lock(connectionsMutex_);
auto it = connections_.find(wsConnPtr);