Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Keep LAN sync device counts consistent https://github.com/siyuan-note/siyuan/issues/18556

Danieleb2185ac48dd
diff --git a/kernel/model/lan_sync.go b/kernel/model/lan_sync.go
index 83aff28f28..052bbc0782 100644
--- a/kernel/model/lan_sync.go
+++ b/kernel/model/lan_sync.go
@@ -342,8 +342,12 @@ func GetSyncLANStatus() map[string]interface{} {
discoveredCount := 0
connectedCount := 0
if nil != manager {
- discoveredCount = manager.DiscoveredPeerCount()
connectedCount = manager.ConnectedPeerCount()
+ discoveredCount = manager.DiscoveredPeerCount()
+ // 已认证设备必然已经被发现,避免两次状态采样之间完成认证时出现数量倒序。
+ if discoveredCount < connectedCount {
+ discoveredCount = connectedCount
+ }
}
enabled := false
maxConcurrentReqs := 16