diff --git a/Cargo.lock b/Cargo.lock index b4d738767..0bf88d399 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1072,7 +1072,7 @@ dependencies = [ [[package]] name = "iroh-quinn" -version = "0.14.0" +version = "0.13.0" dependencies = [ "anyhow", "async-executor", diff --git a/docs/book/Cargo.toml b/docs/book/Cargo.toml index 5726dea12..10f5b48f9 100644 --- a/docs/book/Cargo.toml +++ b/docs/book/Cargo.toml @@ -11,6 +11,6 @@ categories.workspace = true [dependencies] anyhow.workspace = true bytes = { workspace = true } -quinn = { version = "0.14", path = "../../quinn", package = "iroh-quinn" } +quinn = { version = "0.13", path = "../../quinn", package = "iroh-quinn" } rcgen.workspace = true rustls.workspace = true diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 8273fc8b6..e4a512764 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -1467,3 +1467,10 @@ pub enum SendDatagramError { /// This limits the amount of CPU resources consumed by datagram generation, /// and allows other tasks (like receiving ACKs) to run in between. const MAX_TRANSMIT_DATAGRAMS: usize = 20; + +/// The maximum amount of datagrams that are sent in a single transmit +/// +/// This can be lower than the maximum platform capabilities, to avoid excessive +/// memory allocations when calling `poll_transmit()`. Benchmarks have shown +/// that numbers around 10 are a good compromise. +const MAX_TRANSMIT_SEGMENTS: usize = 10; diff --git a/quinn/src/runtime.rs b/quinn/src/runtime.rs index a6bb185ef..3fcc3cd6f 100644 --- a/quinn/src/runtime.rs +++ b/quinn/src/runtime.rs @@ -171,8 +171,7 @@ where // obtain an `&mut WritableFut` after storing it in `self.writable_fut` when `self` is already behind `Pin`, // and if we didn't store it then we wouldn't be able to keep it alive between // `poll_send` calls. - let result = - std::task::ready!(this.writable_fut.as_mut().as_pin_mut().unwrap().poll(cx)); + let result = ready!(this.writable_fut.as_mut().as_pin_mut().unwrap().poll(cx)); // Polling an arbitrary `Future` after it becomes ready is a logic error, so arrange for // a new `Future` to be created on the next call.