mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #227] [Bug] controlWorker函数的defer有问题!!! #158
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#158
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?
Originally created by @jcao-ai on GitHub (Jan 12, 2017).
Original GitHub issue: https://github.com/fatedier/frp/issues/227
先启动一个frpc客户端,再用相同的配置启动frpc,后者会启动失败(这是符合预期的)。但是,你这个defer代码块会去调用s.Close(),而这个方法内部仅仅是依靠p.Name从map中删除。
没错,我的frpc是使用特权模式连接的。因为配置相同,所以导致我前一个客户端被close了!!!!逻辑上这种情况不应该关闭前一个ProxyServer的
@jcao-ai commented on GitHub (Jan 12, 2017):
https://github.com/fatedier/frp/pull/228
@fatedier commented on GitHub (Jan 12, 2017):
if p.PrivilegeMode && oldStatus != consts.Closed这里改为
oldStatus == consts.Working吧。@jcao-ai commented on GitHub (Jan 12, 2017):
@fatedier 改成oldStatus == consts.Working也无用的吧? 因为前一个连接确实状态是Working
@jcao-ai commented on GitHub (Jan 12, 2017):
所以我判断如果是doLogin中新来的CtrlConnection创建proxy失败的话,不让defer内的代码执行了
@fatedier commented on GitHub (Jan 12, 2017):
close 时判断的应该并不是 map 中的 proxy 的状态,而是创建的这个临时 proxy 的,这个 proxy 的状态初始时是 consts.Idle。
我大概看了下的,你可以改下代码测试看看。
@jcao-ai commented on GitHub (Jan 12, 2017):
server.close
DeleteProxy
确实是按照名字从map删除的,我测试过提交了一个PR,但是因为对项目不了解,用了Magic Number
@fatedier commented on GitHub (Jan 12, 2017):
建议你可以试着按照我之前说的将
if p.PrivilegeMode && oldStatus != consts.Closed改为if p.PrivilegeMode && oldStatus == consts.Working测试看是否正常。
这样的改动使 Close 函数符合预期,也尽量避免了特殊处理。
之后可以重新提交一个 PR,注意规范,另外请合并到 dev 分支。
@jcao-ai commented on GitHub (Jan 13, 2017):
好的多谢,稍后处理