fix: ws取消logout字符串退出,当退出后消息读取EOF退出协程

This commit is contained in:
TsMask committed 2024-04-01 16:44:27 +08:00
1 parent 83cd653545
commit a7bb0db03a
2 files changed
+16 -10

No files matched your search

+10 -10
View File
@@ -196,11 +196,11 @@ func (s *WSController) SSH(c *gin.Context) {
wsClient.MsgChan <- msgByte
// 退出ssh登录
if strings.LastIndex(outputStr, "logout\r\n") != -1 {
time.Sleep(1 * time.Second)
s.wsService.CloseClient(wsClient.ID)
return
}
// if strings.LastIndex(outputStr, "logout\r\n") != -1 {
// time.Sleep(1 * time.Second)
// s.wsService.CloseClient(wsClient.ID)
// return
// }
}
}
}()
@@ -283,11 +283,11 @@ func (s *WSController) Telnet(c *gin.Context) {
wsClient.MsgChan <- msgByte
// 退出telnet登录
if strings.LastIndex(outputStr, "logout\r\n") != -1 {
time.Sleep(1 * time.Second)
s.wsService.CloseClient(wsClient.ID)
return
}
// if strings.LastIndex(outputStr, "logout\r\n") != -1 {
// time.Sleep(1 * time.Second)
// s.wsService.CloseClient(wsClient.ID)
// return
// }
}
}
}()