mirror of
https://github.com/aler9/gortsplib
synced 2025-09-28 03:52:12 +08:00
server: remove dashes from session ID (#278)
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
|
|
||||||
"github.com/bluenviron/gortsplib/v3/pkg/base"
|
"github.com/bluenviron/gortsplib/v3/pkg/base"
|
||||||
"github.com/bluenviron/gortsplib/v3/pkg/liberrors"
|
"github.com/bluenviron/gortsplib/v3/pkg/liberrors"
|
||||||
)
|
)
|
||||||
@@ -410,9 +408,8 @@ func (s *Server) run() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
secretID := uuid.New().String()
|
ss := newServerSession(s, req.sc)
|
||||||
ss := newServerSession(s, secretID, req.sc)
|
s.sessions[ss.secretID] = ss
|
||||||
s.sessions[secretID] = ss
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case ss.request <- req:
|
case ss.request <- req:
|
||||||
|
@@ -9,6 +9,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/pion/rtcp"
|
"github.com/pion/rtcp"
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
|
|
||||||
@@ -198,11 +199,13 @@ type ServerSession struct {
|
|||||||
|
|
||||||
func newServerSession(
|
func newServerSession(
|
||||||
s *Server,
|
s *Server,
|
||||||
secretID string,
|
|
||||||
author *ServerConn,
|
author *ServerConn,
|
||||||
) *ServerSession {
|
) *ServerSession {
|
||||||
ctx, ctxCancel := context.WithCancel(s.ctx)
|
ctx, ctxCancel := context.WithCancel(s.ctx)
|
||||||
|
|
||||||
|
// use an UUID without dashes, since dashes confuse some clients.
|
||||||
|
secretID := strings.ReplaceAll(uuid.New().String(), "-", "")
|
||||||
|
|
||||||
ss := &ServerSession{
|
ss := &ServerSession{
|
||||||
s: s,
|
s: s,
|
||||||
secretID: secretID,
|
secretID: secretID,
|
||||||
|
Reference in New Issue
Block a user