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/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ removed).
- [Release audit findings](/quest/m1/release-audit/README.md) - resolve newly identified resource, parser, playback, and interoperability risks before the cut
- [Pre-cut audit findings](/quest/m1/cut-audit/README.md) - fix the crashes, hostile-input costs, and correctness bugs the 2026-10-24 audit of main found
- [Security audit findings](/quest/m1/security-audit/README.md) - fix the verified relay, importer, moq-c, browser, and CI findings of the 2026-10-27 external security audit
- [Cancelled moq-transport requests stop](/quest/m1/ietf-request-cancel.md) - a cancelled request releases its state even when the peer withholds credit
- [Withdrawn advertisements stop](/quest/m1/ietf-withdraw-credit.md) - a withdrawn moq-transport namespace releases its state even when the peer withholds credit
- [Cluster routing](/quest/m1/cluster-routing/README.md) - prove shared routing contracts, implement per-origin routes, and connect outbound local clusters
- [Routing guide](/quest/m1/routing-guide.md) - concepts and practical outbound federation setup
Expand Down
29 changes: 0 additions & 29 deletions quest/m1/ietf-request-cancel.md

This file was deleted.

5 changes: 2 additions & 3 deletions quest/m2/ietf-request-lease.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ one terminal at one await:
[#6237](https://github.com/moq-dev/moq/pull/6237),
[#6409](https://github.com/moq-dev/moq/pull/6409),
[#6433](https://github.com/moq-dev/moq/pull/6433),
[#6643](https://github.com/moq-dev/moq/pull/6643), plus the open
[cancel quest](/quest/m1/ietf-request-cancel.md) and the
[#6643](https://github.com/moq-dev/moq/pull/6643), plus the
[cancel fix](https://github.com/moq-dev/moq/pull/7016) and the
[withdraw fix](https://github.com/moq-dev/moq/pull/6964). Each request
is a long `async fn` whose every `kio::wait` closure re-lists the right
subset of about 46 terminal checks; the two files hold 227 `pin!` sites
Expand Down Expand Up @@ -58,4 +58,3 @@ Public API: none. Wire: none.
## Required

- [moq-transport 18 and 22 only](/quest/m1/ietf-drop/README.md) - deletes about 2,950 production lines and the adapter first
- [Cancelled moq-transport requests stop](/quest/m1/ietf-request-cancel.md) - lands the last point fix this replaces
36 changes: 36 additions & 0 deletions rs/moq-net/src/coding/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ impl<S: crate::transport::poll::SendStream, V: StreamCodes> Writer<S, V> {
kio::wait(|waiter| self.poll_write_all(waiter, buf)).await
}

/// Whether every buffered byte has hit the stream, so a FIN would not cut a message short.
pub fn is_flushed(&self) -> bool {
self.buffer.is_empty()
}

/// Mark the stream as finished.
///
/// Only valid once the buffer has flushed; the callers that finish
Expand Down Expand Up @@ -184,7 +189,15 @@ impl<S: crate::transport::poll::SendStream, V: StreamCodes> Writer<S, V> {
/// discards it, so the [`Drop`] fallback below can throw away bytes the peer never read.
/// Consuming the writer is what removes that fallback, and waiting for the acknowledgement
/// is what makes the bytes safe.
///
/// A message still partly buffered resets the stream with [`Error::Cancel`] instead: a FIN
/// would hand the peer a truncated message, and flushing the rest could wait forever on
/// credit the peer withholds.
pub async fn close(mut self) -> Result<(), Error> {
if !self.is_flushed() {
self.abort(&Error::Cancel);
return Err(Error::Cancel);
}
let Some(mut stream) = self.stream.take() else {
return Ok(());
};
Expand Down Expand Up @@ -365,6 +378,29 @@ mod tests {
assert_eq!(log.priorities(), (0u8..=255).collect::<Vec<_>>());
}

/// A message the stream has not taken whole cannot be finished, so closing resets rather
/// than hand the peer a truncated message.
#[moq_clock::test]
async fn closing_an_unflushed_message_resets() {
let log = Log::default();
let budget = kio::Producer::new(0);
let mut writer = Writer::new(
SinkSend::stepped(log.clone(), budget.consume()),
crate::lite::Version::Lite05,
);
writer.buffer_varint(5).unwrap();
assert!(writer.poll_flush(&kio::Waiter::noop()).is_pending());
assert!(!writer.is_flushed());

assert!(matches!(writer.close().await, Err(Error::Cancel)));
assert_eq!(log.resets(), vec![StreamError::Cancel.to_code()]);
assert!(
!log.trail()
.iter()
.any(|(_, sent)| matches!(sent, crate::lite::test_transport::Sent::Finish))
);
}

/// Writes some bytes, then errors: the shape of a partial encode.
#[derive(Debug)]
struct Poison;
Expand Down
Loading
Loading