mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-11-29 02:42:51 +00:00
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. |
||
|---|---|---|
| .. | ||
| config.json | ||
| inbound.go | ||
| outbound.go | ||
| panel.go | ||
| server.go | ||
| setting.go | ||
| tgbot.go | ||
| user.go | ||
| warp.go | ||
| xray.go | ||
| xray_setting.go | ||