Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m0/nightly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Public API: none. Wire: none.
## Required

- [The receive-windows benchmark runs to the end](/quest/m0/nightly/receive-windows-evicted.md) - `benchmark_receive_windows` stops failing `frame: Evicted`, so the Rust benchmark-tests job publishes its report
- [The relay's startup fits its stack under all features](/quest/m0/nightly/relay-stack.md) - `debug_relay_load_and_run_fit_windows_stack` passes under `--all-features`, fixed at the feature that grew the future
- [moq-net's ingest fuzz target finds no stall](/quest/m0/nightly/ingest-fuzz.md) - the 13-byte stream that stalls ingest is fixed at its cause and kept as a regression test
- [Nightly's shipping-size check passes](/quest/m0/nightly/shipping-size.md) - js/net, js/watch, and moq-relay growth over 5% is traced to its commits, then shrunk or accepted
- [Nightly's Miri job stays inside its time budget](/quest/m0/nightly/miri.md) - Miri gets `rust-src`, then finishes inside its 60-minute job and 15-minute-per-test budgets
26 changes: 0 additions & 26 deletions quest/m0/nightly/relay-stack.md

This file was deleted.

21 changes: 12 additions & 9 deletions rs/moq-relay/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,13 +1258,15 @@ pub struct Cluster {
peer_quic: crate::limits::Quic,
config: Config,
/// Dial template every peer dial is built from; see [`Self::peer_client`].
connect: Option<moq_tokio::connect::Config>,
quic: Option<moq_tokio::quic::Config>,
/// The dial state sits behind `Arc`s because it is several KiB inline, and every
/// clone and every future holding one would copy it, on the stack in debug builds.
connect: Option<Arc<moq_tokio::connect::Config>>,
quic: Option<Arc<moq_tokio::quic::Config>>,
/// The client static and API peers share when the template binds a fixed
/// `[connect]` port, so that port stays the cluster's egress port. Otherwise
/// `None`, and every session builds its own client on an ephemeral port. Built
/// by [`Self::start`] and joins [`Self::dialers`] once [`Started::run`] begins.
dial: Option<moq_tokio::Client>,
dial: Option<Arc<moq_tokio::Client>>,
/// Every dial client, shared by all clones, for [`Self::close`].
dialers: Dialers,
/// Bound listen port and optional generated-certificate fingerprint.
Expand Down Expand Up @@ -1549,8 +1551,8 @@ impl Cluster {
/// Required when any peer is configured; [`start`](Self::start) returns an
/// error otherwise.
pub fn with_connect(mut self, connect: moq_tokio::connect::Config, quic: moq_tokio::quic::Config) -> Self {
self.connect = Some(connect);
self.quic = Some(quic);
self.connect = Some(Arc::new(connect));
self.quic = Some(Arc::new(quic));
self
}

Expand Down Expand Up @@ -1815,7 +1817,7 @@ impl Cluster {
let client = self
.peer_client(!shared, None)
.context("cluster peers configured but the dial template is unusable")?;
self.dial = shared.then_some(client);
self.dial = shared.then(|| Arc::new(client));

// After everything fallible, so a failed start leaves no credential behind.
#[cfg(feature = "cluster-lan")]
Expand Down Expand Up @@ -2138,7 +2140,7 @@ impl Cluster {
// leaves from a fresh port. A fixed `[connect]` bind port names a single
// source port, so static and API peers share the client bound to it instead.
let (client, _held) = match (&self.dial, target.lan) {
(Some(shared), false) => (shared.clone(), None),
(Some(shared), false) => (moq_tokio::Client::clone(shared), None),
_ => {
let client = self.peer_client(true, Some(target))?;
let held = self.dialers.hold(&client)?;
Expand Down Expand Up @@ -2210,7 +2212,8 @@ impl Cluster {
fn peer_client(&self, ephemeral: bool, target: Option<&DialTarget>) -> anyhow::Result<moq_tokio::Client> {
let mut connect = self
.connect
.clone()
.as_deref()
.cloned()
.context("cluster dial without a dial template (call Cluster::with_connect)")?;
if ephemeral {
let mut bind = connect.resolve().bind;
Expand All @@ -2232,7 +2235,7 @@ impl Cluster {
connect.tls = moq_tokio::tls::Connect::default();
connect.tls.fingerprint = vec![fingerprint.to_string()];
}
let mut quic = self.quic.clone().unwrap_or_default();
let mut quic = self.quic.as_deref().cloned().unwrap_or_default();
self.peer_quic.dial(&mut quic);
Ok(connect.init(quic)?)
}
Expand Down
11 changes: 7 additions & 4 deletions rs/moq-relay/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,13 @@ impl Relay {
let auth = auth.clone();
let shutdown = shutdown.clone();
let sessions = sessions.clone();
async move {
// Boxed like the serving futures in the `select!` below.
Box::pin(async move {
match idle {
true => std::future::pending().await,
false => serve_listening(server, cluster, auth, shutdown, sessions).await,
}
}
})
};

let stun = async move {
Expand All @@ -783,9 +784,11 @@ impl Relay {
#[cfg(not(feature = "stun"))]
std::future::pending::<anyhow::Result<()>>().await
};
// Box the large serving futures: a debug build copies each one into this poll's
// stack frame several times, and an embedder's main thread pays for that frame.
let result = tokio::select! {
Err(err) = started.run() => Err(err).context("cluster failed"),
Err(err) = web.serve(web_routes) => Err(err).context("web server failed"),
Err(err) = Box::pin(started.run()) => Err(err).context("cluster failed"),
Err(err) = Box::pin(web.serve(web_routes)) => Err(err).context("web server failed"),
Err(err) = stun => Err(err).context("STUN server failed"),
Err(err) = internal.serve(internal_routes) => Err(err).context("internal server failed"),
Err(err) = serve_shared => Err(err).context("server failed"),
Expand Down
6 changes: 4 additions & 2 deletions rs/moq-relay/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ impl Web {
WebAcceptor::plain(ws, rtmp.clone(), state.clone()),
)?;
server.http_builder().http2().max_concurrent_streams(streams);
Some(server.serve(app.clone()))
Some(Box::pin(server.serve(app.clone())))
} else {
None
};
Expand Down Expand Up @@ -526,11 +526,13 @@ impl Web {
),
)?;
server.http_builder().http2().max_concurrent_streams(streams);
Some(server.serve(app))
Some(Box::pin(server.serve(app)))
} else {
None
};

// Both servers are boxed, since a debug build copies each one into this poll's
// stack frame several times.
tokio::select! {
Some(res) = async move { Some(http?.await) } => res?,
Some(res) = async move { Some(https?.await) } => res?,
Expand Down
Loading