mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[PR #3504] [MERGED] service.Run supports passing in context #4766
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#4766
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fatedier/frp/pull/3504
Author: @fatedier
Created: 6/29/2023
Status: ✅ Merged
Merged: 6/29/2023
Merged by: @fatedier
Base:
dev← Head:fix-2581📝 Commits (1)
d50e432service.Run supports passing in context📊 Changes
5 files changed (+39 additions, -18 deletions)
View changed files
📝
.github/pull_request_template.md(+0 -4)📝
client/service.go(+15 -6)📝
cmd/frpc/sub/root.go(+2 -1)📝
cmd/frps/root.go(+2 -1)📝
server/service.go(+20 -6)📄 Description
Summary
🤖 Generated by Copilot at 0fd5042
This pull request refactors the context management of the client and server packages, by passing contexts to the
Runmethods of theServicestructs. This allows for graceful shutdown and cancellation of the services, and improves the consistency and readability of the code. It also updates thecmd/frpcandcmd/frpscommands to use the context package and pass contexts to the services.WHY
Fix #2581
Walkthrough
🤖 Generated by Copilot at 0fd5042
Runmethod ofServicestruct inclientandserverpackages, and create new context with cancel from it (link, link, link, link)ctxandcancelfields fromServicestruct inclientandserverpackages, and store them as local variables inRunmethod (link, link, link, link)clientpackage, or if context is done inserverpackage (link, link)svr.ctlandsvr.cancelto nil after closing them inGracefulClosemethod ofServicestruct inclientpackage, and check for nil before calling them (link)svr.listenerandsvr.tlsConfigto nil after closing them inClosemethod ofServicestruct inserverpackage, and check for nil before callingsvr.cancel(link)keepControllerWorkingfunction ofclientpackage to reflect actual delay in reconnecting to server (link)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.