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

View File

@ -91,7 +91,7 @@ struct ReceivedMessage {
/// codec-specified clock rate.
/// * the full timestamp.
/// * NPT
#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Timestamp {
/// A timestamp which must be compared to `start`.
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`].
pub const UNIX_EPOCH: NtpTimestamp = NtpTimestamp((2_208_988_800) << 32);