场景时间更新,自动切换气象初步

This commit is contained in:
unkown committed 2023-10-10 15:26:20 +08:00
1 parent 1bcde691bc
commit be737e45e9
7 files changed
+107 -33

No files matched your search

+12
View File
@@ -111,6 +111,7 @@ func runPacketCaptureApi() {
e := gin.Default()
e.GET("/packet/capture/ws", packetCaptureWs)
e.GET("/packet/capture/list", packetCaptureList)
e.GET("/packet/capture/clear", packetCaptureClear)
port := config.GetConfig().HttpPort
addr := ":" + strconv.Itoa(int(port))
err := e.Run(addr)
@@ -156,6 +157,17 @@ func packetCaptureList(ctx *gin.Context) {
_, _ = ctx.Writer.WriteString(string(data))
}
func packetCaptureClear(ctx *gin.Context) {
if PacketCaptureSession == nil {
_, _ = ctx.Writer.WriteString("500")
return
}
PacketCaptureSession.PktLock.Lock()
PacketCaptureSession.PktList = make([]*net.Packet, 0)
PacketCaptureSession.PktLock.Unlock()
_, _ = ctx.Writer.WriteString("ok")
}
func runForward(messageQueue *mq.MessageQueue) {
for {
netMsg := <-messageQueue.GetNetMsg()