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:
@@ -486,15 +486,15 @@ async fn ws_handler(
|
||||
.and_then(|s| s.trim().parse::<IpAddr>().ok())
|
||||
.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 count = conns.get(&ip).copied().unwrap_or(0);
|
||||
if count >= 4 {
|
||||
tracing::warn!("IP {} ylitti yhteysrajan ({}/4) — estetty", ip, count);
|
||||
if count >= 10 {
|
||||
tracing::warn!("IP {} ylitti yhteysrajan ({}/10) — estetty", ip, count);
|
||||
return (
|
||||
axum::http::StatusCode::TOO_MANY_REQUESTS,
|
||||
"Max 4 yhteyttä per IP",
|
||||
"Max 10 yhteyttä per IP",
|
||||
).into_response();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user