Skip to content

Add UserConnTracker to manage user connection cancellations across proxies#5844

Open
ImMohammad20000 wants to merge 2 commits intoXTLS:mainfrom
ImMohammad20000:UserConnTracker
Open

Add UserConnTracker to manage user connection cancellations across proxies#5844
ImMohammad20000 wants to merge 2 commits intoXTLS:mainfrom
ImMohammad20000:UserConnTracker

Conversation

@ImMohammad20000
Copy link

@ImMohammad20000 ImMohammad20000 commented Mar 25, 2026

there is an old bug that lead to a big issue in panels that leve connections open when users remove from inbounds via gRPC api the connection to that user dose not close in some cases so i implement a connection tracker that track all connections and close theme when users remove from the inbounds

an example of the issue is user limited to 1GB but becouse connections not closed it used 18GB

image

@RPRX
Copy link
Member

RPRX commented Mar 26, 2026

#5401 连接追踪是会加的,不过怎么设计还要再考虑下

我看了下你的代码,为啥要 register unregister,每个 user 内存中自带一个 ctx 然后被 remove 时直接 cancel() 不就行了

应该不用考虑整个入站被移除?那个连端口都被释放了

@ImMohammad20000
Copy link
Author

ImMohammad20000 commented Mar 26, 2026

I considered that approach, but I wanted to ensure connections are tracked across all proxies without relying on each inbound’s internal context, especially since the removal comes via gRPC API and the user might be referenced from multiple places. Using a separate tracker makes it explicit and easier to debug. Happy to refactor if you think a simpler ctx-based approach inside each user struct.

@Fangliding
Copy link
Member

这不就是个机场计费 helper

@RPRX
Copy link
Member

RPRX commented Mar 27, 2026

等新的正式版发布后再讨论一下吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants