[GH-ISSUE #329] 源代码中看不到创建连接池 #243

Closed
opened 2026-05-05 12:02:15 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @FunTCode on GitHub (May 22, 2017).
Original GitHub issue: https://github.com/fatedier/frp/issues/329

connectionPoolManager函数里只看到往ctlMsgChan放入1,到看不到frps向frpc发送请求,代码如下:

// check if we need more work connections and send messages to frpc to get more
time.Sleep(time.Duration(2) * time.Second)
select {
// if the channel closed, it means the proxy is closed, so just return
case <-closeCh:
log.Info("ProxyName [%s], connectionPoolManager exit", p.Name)
return
default:
curWorkConnNum := int64(len(p.workConnChan))
diff := p.PoolCount - curWorkConnNum
if diff > 0 {
if diff < p.PoolCount/5 {
diff = p.PoolCount4/5 + 1
} else if diff < p.PoolCount/2 {
diff = p.PoolCount/4 + 1
} else if diff < p.PoolCount
4/5 {
diff = p.PoolCount/5 + 1
} else {
diff = p.PoolCount/10 + 1
}
if diff+curWorkConnNum > p.PoolCount {
diff = p.PoolCount - curWorkConnNum
}
for i := 0; i < int(diff); i++ {
p.ctlMsgChan <- 1
}

Originally created by @FunTCode on GitHub (May 22, 2017). Original GitHub issue: https://github.com/fatedier/frp/issues/329 connectionPoolManager函数里只看到往ctlMsgChan放入1,到看不到frps向frpc发送请求,代码如下: // check if we need more work connections and send messages to frpc to get more time.Sleep(time.Duration(2) * time.Second) select { // if the channel closed, it means the proxy is closed, so just return case <-closeCh: log.Info("ProxyName [%s], connectionPoolManager exit", p.Name) return default: curWorkConnNum := int64(len(p.workConnChan)) diff := p.PoolCount - curWorkConnNum if diff > 0 { if diff < p.PoolCount/5 { diff = p.PoolCount*4/5 + 1 } else if diff < p.PoolCount/2 { diff = p.PoolCount/4 + 1 } else if diff < p.PoolCount*4/5 { diff = p.PoolCount/5 + 1 } else { diff = p.PoolCount/10 + 1 } if diff+curWorkConnNum > p.PoolCount { diff = p.PoolCount - curWorkConnNum } for i := 0; i < int(diff); i++ { p.ctlMsgChan <- 1 }
Author
Owner

@fatedier commented on GitHub (May 22, 2017):

代码交流可以加 qq群或者直接给我发邮件,不要建 issue。

这部分代码 v0.10.0 已经修改过了,被废弃了,发送流程在另外的协程里。

<!-- gh-comment-id:303067297 --> @fatedier commented on GitHub (May 22, 2017): 代码交流可以加 qq群或者直接给我发邮件,不要建 issue。 这部分代码 v0.10.0 已经修改过了,被废弃了,发送流程在另外的协程里。
Author
Owner

@FunTCode commented on GitHub (May 22, 2017):

好的,不好意思,.net程序员第一次用github,谢谢前辈指导。

<!-- gh-comment-id:303070038 --> @FunTCode commented on GitHub (May 22, 2017): 好的,不好意思,.net程序员第一次用github,谢谢前辈指导。
Author
Owner

@fatedier commented on GitHub (May 22, 2017):

没事,欢迎对于源码的交流和探讨,共同进步。

<!-- gh-comment-id:303074889 --> @fatedier commented on GitHub (May 22, 2017): 没事,欢迎对于源码的交流和探讨,共同进步。
Author
Owner

@FunTCode commented on GitHub (May 22, 2017):

能否提供一下qq群号码?我发现好多仿冒网站都不知哪个是官方

<!-- gh-comment-id:303080955 --> @FunTCode commented on GitHub (May 22, 2017): 能否提供一下qq群号码?我发现好多仿冒网站都不知哪个是官方
Author
Owner

@fatedier commented on GitHub (May 22, 2017):

606194980

<!-- gh-comment-id:303100827 --> @fatedier commented on GitHub (May 22, 2017): 606194980
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#243
No description provided.