Skip to content

Commit

Permalink
refactor: have process_input delegate to process_multiple_input (mozi…
Browse files Browse the repository at this point in the history
…lla#1792)

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`.
  • Loading branch information
mxinden authored Apr 5, 2024
1 parent 1dc8ea3 commit 5dfe106
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use std::{
cell::RefCell,
fmt::{Debug, Display},
mem,
iter, mem,
net::SocketAddr,
rc::Rc,
time::Instant,
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5dfe106

Please sign in to comment.