Fix error on session id changed

This commit is contained in:
Andrey Tkachenko 2022-10-26 17:36:24 +03:00
parent f69d746a42
commit 11e4a7335f
2 changed files with 13 additions and 21 deletions

View File

@ -1488,21 +1488,18 @@ impl Session<Described> {
description, description,
}) })
})?; })?;
match inner.session.as_ref() {
Some(SessionHeader { id, .. }) if id.as_ref() != &*response.session.id => { match inner.session.as_mut() {
bail!(ErrorInt::RtspResponseError { Some(sess_header) => {
conn_ctx: *conn.inner.ctx(), if sess_header.id.as_ref() != &*response.session.id {
msg_ctx, debug!(
method: rtsp_types::Method::Setup, "reestablished session {:?}(was {:?}), timeout={}s",
cseq, response.session.id, sess_header.id, response.session.timeout_sec
status, );
description: format!( *sess_header = response.session;
"session id changed from {:?} to {:?}",
id, response.session.id,
),
});
} }
Some(_) => {} }
None => { None => {
debug!( debug!(
"established session {:?}, timeout={}s", "established session {:?}, timeout={}s",
@ -1511,6 +1508,7 @@ impl Session<Described> {
*inner.session = Some(response.session) *inner.session = Some(response.session)
} }
}; };
let conn_ctx = conn.inner.ctx(); let conn_ctx = conn.inner.ctx();
let (stream_ctx, udp_sockets); let (stream_ctx, udp_sockets);
match udp { match udp {

View File

@ -91,7 +91,7 @@ struct ReceivedMessage {
/// codec-specified clock rate. /// codec-specified clock rate.
/// * the full timestamp. /// * the full timestamp.
/// * NPT /// * NPT
#[derive(Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Timestamp { pub struct Timestamp {
/// A timestamp which must be compared to `start`. /// A timestamp which must be compared to `start`.
timestamp: i64, timestamp: i64,
@ -171,12 +171,6 @@ impl Display for Timestamp {
} }
} }
impl Debug for Timestamp {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Display::fmt(self, f)
}
}
/// The Unix epoch as an [`NtpTimestamp`]. /// The Unix epoch as an [`NtpTimestamp`].
pub const UNIX_EPOCH: NtpTimestamp = NtpTimestamp((2_208_988_800) << 32); pub const UNIX_EPOCH: NtpTimestamp = NtpTimestamp((2_208_988_800) << 32);