fix race condition

This commit is contained in:
aler9 2021-10-17 17:16:57 +02:00
parent e6238694af
commit f32d69a93d
3 changed files with 3 additions and 2 deletions

View File

@ -297,7 +297,6 @@ func newAPI(
parent: parent,
}
gin.SetMode(gin.ReleaseMode)
router := gin.New()
router.NoRoute(a.mwLog)
group := router.Group("/", a.mwLog)

View File

@ -7,6 +7,7 @@ import (
"reflect"
"sync/atomic"
"github.com/gin-gonic/gin"
"gopkg.in/alecthomas/kingpin.v2"
"github.com/aler9/rtsp-simple-server/internal/conf"
@ -64,6 +65,8 @@ func New(args []string) (*Core, bool) {
// do not check for errors
rlimit.Raise()
gin.SetMode(gin.ReleaseMode)
ctx, ctxCancel := context.WithCancel(context.Background())
p := &Core{

View File

@ -100,7 +100,6 @@ func (s *hlsServer) close() {
func (s *hlsServer) run() {
defer s.wg.Done()
gin.SetMode(gin.ReleaseMode)
router := gin.New()
router.NoRoute(s.onRequest)