moq_transport/session/
track_status_requested.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use super::{Publisher, SessionError};
use crate::message;

#[derive(Debug, Clone)]
pub struct TrackStatusRequestedInfo {
	pub namespace: String,
	pub track: String,
}

pub struct TrackStatusRequested {
	publisher: Publisher,
	// msg: message::TrackStatusRequest, // TODO: See if we actually need this
	pub info: TrackStatusRequestedInfo,
}

impl TrackStatusRequested {
	pub fn new(publisher: Publisher, msg: message::TrackStatusRequest) -> Self {
		let namespace = msg.track_namespace.clone();
		let track = msg.track_name.clone();
		Self {
			publisher,
			info: TrackStatusRequestedInfo { namespace, track },
		}
	}

	pub async fn respond(&mut self, status: message::TrackStatus) -> Result<(), SessionError> {
		self.publisher.send_message(status);
		Ok(())
	}
}