mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 18:50:27 +08:00
服务最大连接数和单IP最大连接数任其一不为0则生效
This commit is contained in:
@@ -35,7 +35,7 @@ func NewClientConnLimiter() *ClientConnLimiter {
|
|||||||
// Add 添加新连接
|
// Add 添加新连接
|
||||||
// 返回值为true的时候表示允许添加;否则表示不允许添加
|
// 返回值为true的时候表示允许添加;否则表示不允许添加
|
||||||
func (this *ClientConnLimiter) Add(rawRemoteAddr string, serverId int64, remoteAddr string, maxConnsPerServer int, maxConnsPerIP int) bool {
|
func (this *ClientConnLimiter) Add(rawRemoteAddr string, serverId int64, remoteAddr string, maxConnsPerServer int, maxConnsPerIP int) bool {
|
||||||
if maxConnsPerServer <= 0 || maxConnsPerIP <= 0 || len(remoteAddr) == 0 || serverId <= 0 {
|
if (maxConnsPerServer <= 0 && maxConnsPerIP <= 0) || len(remoteAddr) == 0 || serverId <= 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user