IP-yhteysraja nostettu 4→10: mahdollistaa useamman laitteen samasta IP:stä

Jokainen selain tarvitsee 2 WebSocket-yhteyttä (UI + coder-node).
Vanha raja 4 esti toisen koneen yhdistämisen samasta IP:stä (esim. kotiverkko).
Uusi raja 10 riittää 5 samanaikaiselle selaimelle / laitteelle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaakko Vanhala
2026-04-06 08:56:36 +03:00
parent 0c32fecdc4
commit 3976bb6251

View File

@@ -486,15 +486,15 @@ async fn ws_handler(
.and_then(|s| s.trim().parse::<IpAddr>().ok()) .and_then(|s| s.trim().parse::<IpAddr>().ok())
.unwrap_or_else(|| addr.ip()); .unwrap_or_else(|| addr.ip());
// Max 2 yhteyttä per IP (dashboard-UI + selainsolmu) // Max yhteyttä per IP: jokainen selain tarvitsee 2 (UI + coder-node)
{ {
let conns = state.ip_connections.lock().unwrap(); let conns = state.ip_connections.lock().unwrap();
let count = conns.get(&ip).copied().unwrap_or(0); let count = conns.get(&ip).copied().unwrap_or(0);
if count >= 4 { if count >= 10 {
tracing::warn!("IP {} ylitti yhteysrajan ({}/4) — estetty", ip, count); tracing::warn!("IP {} ylitti yhteysrajan ({}/10) — estetty", ip, count);
return ( return (
axum::http::StatusCode::TOO_MANY_REQUESTS, axum::http::StatusCode::TOO_MANY_REQUESTS,
"Max 4 yhteyttä per IP", "Max 10 yhteyttä per IP",
).into_response(); ).into_response();
} }
} }