3x-ui/web/service
OleksandrParshyn bb78b9495a
Fix: Prevent race condition and goroutine leak in TgBot
Addresses a critical race condition on the global `botCancel` variable, which could occur if `Tgbot.OnReceive()` was called concurrently (e.g., during rapid panel restarts or unexpected behavior).

Changes in tgbot.go:
- Added `tgBotMutex sync.Mutex` to ensure thread safety.
- Protected `botCancel` creation and assignment in `OnReceive()` using the mutex, and added a check to prevent overwriting an active context, which avoids goroutine leaks.
- Protected the cancellation and cleanup logic in `StopBot()` with the mutex.
2025-10-31 14:57:36 +01:00
..
config.json dokodemo-door, socks renamed to mixed, tunnel 2025-09-09 13:57:40 +02:00
inbound.go gofmt 2025-10-21 13:02:55 +02:00
outbound.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
panel.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
server.go fix(import): prevent sqlite disk I/O error by validating temp DB then swapping 2025-10-14 22:03:17 +02:00
setting.go gofmt 2025-10-21 13:02:55 +02:00
tgbot.go Fix: Prevent race condition and goroutine leak in TgBot 2025-10-31 14:57:36 +01:00
user.go gofmt 2025-10-21 13:02:55 +02:00
warp.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
xray.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
xray_setting.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00