From f9322f620034918316037217e01290e8be7de141 Mon Sep 17 00:00:00 2001 From: naiba Date: Thu, 19 Aug 2021 11:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20range=20=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=20closed=20channel=20:LOL:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- cmd/dashboard/controller/common_page.go | 7 +++++-- service/dao/dao.go | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a462422..4d5ebc7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
LOGO designed by 熊大 .

-    +   

:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。

diff --git a/cmd/dashboard/controller/common_page.go b/cmd/dashboard/controller/common_page.go index 6c2893e..6b6c0b8 100644 --- a/cmd/dashboard/controller/common_page.go +++ b/cmd/dashboard/controller/common_page.go @@ -296,21 +296,22 @@ func (cp *commonPage) terminal(c *gin.Context) { go func() { connectDeadline := time.NewTimer(time.Second * 15) <-connectDeadline.C - close(deadlineCh) + deadlineCh <- struct{}{} }() dataCh := make(chan []byte) + errorCh := make(chan error) go func() { for { msgType, data, err := conn.ReadMessage() if err != nil { + errorCh <- err return } // 将文本消息转换为命令输入 if msgType == websocket.TextMessage { data = append([]byte{0}, data...) } - dataCh <- data } }() @@ -324,6 +325,8 @@ func (cp *commonPage) terminal(c *gin.Context) { if distConn == nil { return } + case <-errorCh: + return case data := <-dataCh: dataBuffer = append(dataBuffer, data) if distConn == nil { diff --git a/service/dao/dao.go b/service/dao/dao.go index a65c2ec..e91268a 100644 --- a/service/dao/dao.go +++ b/service/dao/dao.go @@ -13,7 +13,7 @@ import ( pb "github.com/naiba/nezha/proto" ) -var Version = "v0.9.27" // !!记得修改 README 中的 badge 版本!! +var Version = "v0.9.28" // !!记得修改 README 中的 badge 版本!! var ( Conf *model.Config