Browse Source

fix race condition

pull/666/head
aler9 5 years ago
parent
commit
f32d69a93d
  1. 1
      internal/core/api.go
  2. 3
      internal/core/core.go
  3. 1
      internal/core/hls_server.go

1
internal/core/api.go

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

3
internal/core/core.go

@ -7,6 +7,7 @@ import ( @@ -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) { @@ -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{

1
internal/core/hls_server.go

@ -100,7 +100,6 @@ func (s *hlsServer) close() { @@ -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)

Loading…
Cancel
Save