1 Star 0 Fork 0

von/RTSPtoWeb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
RTSPtoWeb.go 873 Bytes
一键复制 编辑 原始数据 按行查看 历史
Andrey Semochkin 提交于 2021-02-18 14:10 . add closer
package main
import (
"os"
"os/signal"
"syscall"
"time"
"github.com/sirupsen/logrus"
)
func main() {
log.WithFields(logrus.Fields{
"module": "main",
"func": "main",
}).Info("Server CORE start")
go HTTPAPIServer()
go RTSPServer()
go Storage.StreamChannelRunAll()
signalChanel := make(chan os.Signal, 1)
done := make(chan bool, 1)
signal.Notify(signalChanel, syscall.SIGINT, syscall.SIGTERM)
go func() {
sig := <-signalChanel
log.WithFields(logrus.Fields{
"module": "main",
"func": "main",
}).Info("Server receive signal", sig)
done <- true
}()
log.WithFields(logrus.Fields{
"module": "main",
"func": "main",
}).Info("Server start success a wait signals")
<-done
Storage.StopAll()
time.Sleep(2 * time.Second)
log.WithFields(logrus.Fields{
"module": "main",
"func": "main",
}).Info("Server stop working by signal")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/wkz/RTSPtoWeb.git
git@gitee.com:wkz/RTSPtoWeb.git
wkz
RTSPtoWeb
RTSPtoWeb
master

搜索帮助