From a63c80de2f62f8a56a085b03dd18e9fd73295660 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 4 Apr 2024 20:55:50 +0200 Subject: [PATCH] refactor: have process_input delegate to process_multiple_input The `Connection::process_input` and `Connection::process_multiple_input` functions are identical, except that the latter handles multiple `Datagram`s. To avoid any changes to one without updating the other, have `process_input` simply delegate to `process_multiple_input`. Commit also does the equivalent change to `neqo_http3::Http3Client`. --- neqo-http3/src/connection_client.rs | 6 ++---- neqo-transport/src/connection/mod.rs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/neqo-http3/src/connection_client.rs b/neqo-http3/src/connection_client.rs index 836816b337..be20126353 100644 --- a/neqo-http3/src/connection_client.rs +++ b/neqo-http3/src/connection_client.rs @@ -7,7 +7,7 @@ use std::{ cell::RefCell, fmt::{Debug, Display}, - mem, + iter, mem, net::SocketAddr, rc::Rc, time::Instant, @@ -874,9 +874,7 @@ impl Http3Client { /// /// [1]: ../neqo_transport/enum.ConnectionEvent.html pub fn process_input(&mut self, dgram: &Datagram, now: Instant) { - qtrace!([self], "Process input."); - self.conn.process_input(dgram, now); - self.process_http3(now); + self.process_multiple_input(iter::once(dgram), now); } pub fn process_multiple_input<'a, I>(&mut self, dgrams: I, now: Instant) diff --git a/neqo-transport/src/connection/mod.rs b/neqo-transport/src/connection/mod.rs index 06d6cab9e1..9cddcdac28 100644 --- a/neqo-transport/src/connection/mod.rs +++ b/neqo-transport/src/connection/mod.rs @@ -10,7 +10,7 @@ use std::{ cell::RefCell, cmp::{max, min}, fmt::{self, Debug}, - mem, + iter, mem, net::{IpAddr, SocketAddr}, ops::RangeInclusive, rc::{Rc, Weak}, @@ -978,9 +978,7 @@ impl Connection { /// Process new input datagrams on the connection. pub fn process_input(&mut self, d: &Datagram, now: Instant) { - self.input(d, now, now); - self.process_saved(now); - self.streams.cleanup_closed_streams(); + self.process_multiple_input(iter::once(d), now); } /// Process new input datagrams on the connection.