Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
net-liquid
net-liquid
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

  • chainmaker
  • net-liquidnet-liquid
  • Issues
  • #1

Closed
Open
Opened Jan 17, 2024 by Ramboll Wang@rambollDeveloper

Level Connection Manager的IsAllowed方法有BUG

RT, 修复代码如下:

// IsAllowed return true if peer can connect to self. Otherwise, return false.
func (cm *LevelConnManager) IsAllowed(pid peer.ID) bool {
	cm.cmLock.RLock()
	defer cm.cmLock.RUnlock()
	currentCount := 0
	if s, idx := cm.getHighLevelConnections(pid); idx != -1 {
		currentCount = currentCount + s.Size()
	}
	if s, idx := cm.getLowLevelConnections(pid); idx != -1 {
		currentCount = currentCount + s.Size()
	}
	if currentCount > 0 {
		return currentCount < cm.maxConnCountEachPeerAllowed
	}
	isHighLevel := cm.IsHighLevel(pid)
	if cm.strategy == LIFO {
		if isHighLevel {
			return len(cm.highLevelConn) < cm.maxPeerCountAllowed
		}
		return len(cm.highLevelConn)+len(cm.lowLevelConn) < cm.maxPeerCountAllowed
	}
	if !isHighLevel {
		return len(cm.highLevelConn) < cm.maxPeerCountAllowed
	}
	return true
}
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: chainmaker/net-liquid#1

Copyright © 2021 ChainMaker Org. All Rights Reserved. 长安链 版权所有。