mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
⚡️ WS 通信阻塞读写锁
This commit is contained in:
@@ -140,14 +140,16 @@ func (cp *commonPage) ws(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
var servers []*model.Server
|
||||
count := 0
|
||||
for {
|
||||
singleton.SortedServerLock.RLock()
|
||||
servers = singleton.SortedServerList
|
||||
singleton.SortedServerLock.RUnlock()
|
||||
err = conn.WriteJSON(Data{
|
||||
Now: time.Now().Unix() * 1000,
|
||||
Servers: singleton.SortedServerList,
|
||||
Servers: servers,
|
||||
})
|
||||
singleton.SortedServerLock.RUnlock()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user