mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 20:58:14 -05:00
🐛 range 了一个 closed channel :LOL:
This commit is contained in:
parent
59046a15bd
commit
f9322f6200
@ -4,7 +4,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.27&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.6.7-brightgreen?style=for-the-badge&logo=linux">
|
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.28&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.6.7-brightgreen?style=for-the-badge&logo=linux">
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
|
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
|
||||||
|
@ -296,21 +296,22 @@ func (cp *commonPage) terminal(c *gin.Context) {
|
|||||||
go func() {
|
go func() {
|
||||||
connectDeadline := time.NewTimer(time.Second * 15)
|
connectDeadline := time.NewTimer(time.Second * 15)
|
||||||
<-connectDeadline.C
|
<-connectDeadline.C
|
||||||
close(deadlineCh)
|
deadlineCh <- struct{}{}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
dataCh := make(chan []byte)
|
dataCh := make(chan []byte)
|
||||||
|
errorCh := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
msgType, data, err := conn.ReadMessage()
|
msgType, data, err := conn.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
errorCh <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 将文本消息转换为命令输入
|
// 将文本消息转换为命令输入
|
||||||
if msgType == websocket.TextMessage {
|
if msgType == websocket.TextMessage {
|
||||||
data = append([]byte{0}, data...)
|
data = append([]byte{0}, data...)
|
||||||
}
|
}
|
||||||
|
|
||||||
dataCh <- data
|
dataCh <- data
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -324,6 +325,8 @@ func (cp *commonPage) terminal(c *gin.Context) {
|
|||||||
if distConn == nil {
|
if distConn == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case <-errorCh:
|
||||||
|
return
|
||||||
case data := <-dataCh:
|
case data := <-dataCh:
|
||||||
dataBuffer = append(dataBuffer, data)
|
dataBuffer = append(dataBuffer, data)
|
||||||
if distConn == nil {
|
if distConn == nil {
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
pb "github.com/naiba/nezha/proto"
|
pb "github.com/naiba/nezha/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "v0.9.27" // !!记得修改 README 中的 badge 版本!!
|
var Version = "v0.9.28" // !!记得修改 README 中的 badge 版本!!
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Conf *model.Config
|
Conf *model.Config
|
||||||
|
Loading…
Reference in New Issue
Block a user