3x-ui/web
Hamed d6d2085d60
fix: restart remote xray after disabling a client to kill active sessions (#4918)
* fix(node-traffic): restart remote xray after disabling clients to kill active sessions

When a client's traffic limit is reached on a remote node, the panel pushes
enable=false to that node via UpdateInbound. The node calls RemoveUser on its
local xray, which blocks new connections but leaves any already-established TCP
session alive. The user could continue browsing/downloading until they
disconnected voluntarily.

Fix: after successfully pushing a client disable to a remote node, call
RestartXray on that node. This mirrors what already happens for the local node
when the "Restart Xray on client disable" setting is enabled (default: on),
and ensures active sessions are terminated immediately on all nodes where the
client was disabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(node): restart remote xray after tx commit, not inside it

Move the remote RestartXray calls out of the addTraffic write
transaction. disableInvalidClients now returns the affected remote
node IDs instead of restarting their xray while the SQLite write lock
is held; AddTraffic performs the restart after the transaction commits
via restartRemoteNodesOnDisable. Avoids holding the serialized write
lock across slow per-node restart RPCs.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
2026-06-05 00:02:52 +02:00
..
controller fix(multi-node): scope remote client update/delete to one inbound (#4892) 2026-06-04 16:45:40 +02:00
entity feat(sub): modern xray JSON format with unified finalmask editor (#4912) 2026-06-04 23:51:48 +02:00
global Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00
job fix(online): scope per-inbound online to inbounds that carried traffic 2026-06-03 16:19:00 +02:00
locale v3 2026-05-10 02:13:42 +02:00
middleware feat: complete Zod migration of frontend + bulk client batching (#4599) 2026-05-27 04:26:50 +02:00
network docs: add comments for all functions 2025-09-20 09:35:50 +02:00
runtime fix(multi-node): scope remote client update/delete to one inbound (#4892) 2026-06-04 16:45:40 +02:00
service fix: restart remote xray after disabling a client to kill active sessions (#4918) 2026-06-05 00:02:52 +02:00
session Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
translation feat(sub): modern xray JSON format with unified finalmask editor (#4912) 2026-06-04 23:51:48 +02:00
websocket fix(websocket): order register/unregister via single ops channel 2026-05-19 12:34:53 +02:00
web.go feat(dashboard): more System History metrics, persistence & localized labels 2026-06-03 12:16:31 +02:00