mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
server: send session timeout to clients through the session header (https://github.com/aler9/rtsp-simple-server/issues/702)
This commit is contained in:
@@ -283,7 +283,13 @@ func (ss *ServerSession) run() {
|
||||
if res.Header == nil {
|
||||
res.Header = make(base.Header)
|
||||
}
|
||||
res.Header["Session"] = base.HeaderValue{ss.secretID}
|
||||
res.Header["Session"] = headers.Session{
|
||||
Session: ss.secretID,
|
||||
Timeout: func() *uint {
|
||||
v := uint(ss.s.sessionTimeout / time.Second)
|
||||
return &v
|
||||
}(),
|
||||
}.Write()
|
||||
}
|
||||
|
||||
if _, ok := err.(liberrors.ErrServerSessionTeardown); ok {
|
||||
@@ -337,7 +343,7 @@ func (ss *ServerSession) run() {
|
||||
}
|
||||
|
||||
// in case of PLAY and UDP, timeout happens when no RTSP request arrives
|
||||
} else if now.Sub(ss.lastRequestTime) >= ss.s.closeSessionAfterNoRequestsFor {
|
||||
} else if now.Sub(ss.lastRequestTime) >= ss.s.sessionTimeout {
|
||||
return liberrors.ErrServerNoRTSPRequestsInAWhile{}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user