[PR #5218] [MERGED] server/control: deduplicate close-proxy logic and UserInfo construction #5183

Closed
opened 2026-05-05 14:56:15 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/5218
Author: @fatedier
Created: 3/7/2026
Status: Merged
Merged: 3/7/2026
Merged by: @fatedier

Base: devHead: new


📝 Commits (1)

  • 8bb5ba9 server/control: deduplicate close-proxy logic and UserInfo construction

📊 Changes

1 file changed (+32 additions, -47 deletions)

View changed files

📝 server/control.go (+32 -47)

📄 Description

Summary

  • Extract closeProxy() helper to eliminate duplicated 4-step cleanup sequence (Close, PxyManager.Del, metrics report, plugin notify) between worker() and CloseProxy()
  • Extract loginUserInfo() helper to eliminate 4 repeated plugin.UserInfo constructions using LoginMsg fields
  • Optimize worker() to snapshot and clear the proxies map under lock, then perform cleanup outside the lock to reduce lock hold time

Changes

Single file: server/control.go (+32, -47)

Test plan

  • go build ./server/... passes
  • golangci-lint run ./server/... — 0 issues
  • go test ./server/... ./pkg/... — all pass
  • Reviewed by Codex — no regressions found

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/5218 **Author:** [@fatedier](https://github.com/fatedier) **Created:** 3/7/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@fatedier](https://github.com/fatedier) **Base:** `dev` ← **Head:** `new` --- ### 📝 Commits (1) - [`8bb5ba9`](https://github.com/fatedier/frp/commit/8bb5ba9f2da621d6f919703db39d2c8dd9582f32) server/control: deduplicate close-proxy logic and UserInfo construction ### 📊 Changes **1 file changed** (+32 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `server/control.go` (+32 -47) </details> ### 📄 Description ## Summary - Extract `closeProxy()` helper to eliminate duplicated 4-step cleanup sequence (`Close`, `PxyManager.Del`, metrics report, plugin notify) between `worker()` and `CloseProxy()` - Extract `loginUserInfo()` helper to eliminate 4 repeated `plugin.UserInfo` constructions using `LoginMsg` fields - Optimize `worker()` to snapshot and clear the proxies map under lock, then perform cleanup outside the lock to reduce lock hold time ## Changes Single file: `server/control.go` (+32, -47) ## Test plan - [x] `go build ./server/...` passes - [x] `golangci-lint run ./server/...` — 0 issues - [x] `go test ./server/... ./pkg/...` — all pass - [x] Reviewed by Codex — no regressions found --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:56:15 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5183
No description provided.