优化代码

This commit is contained in:
dushixiang
2022-05-06 21:10:29 +08:00
parent c58776fa24
commit 7357cebc34
16 changed files with 159 additions and 208 deletions

View File

@ -85,11 +85,10 @@ func (r *TermHandler) writeToWebsocket() {
}
nextSession := session.GlobalSessionManager.GetById(r.sessionId)
// 监控
if nextSession != nil && len(nextSession.Observer.All()) > 0 {
obs := nextSession.Observer.All()
for _, ob := range obs {
if nextSession != nil && nextSession.Observer != nil {
nextSession.Observer.Range(func(key string, ob *session.Session) {
_ = ob.WriteMessage(dto.NewMessage(Data, s))
}
})
}
buf = []byte{}
}