summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-http3/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/rust/neqo-http3/src/connection.rs20
-rw-r--r--third_party/rust/neqo-http3/src/connection_client.rs17
-rw-r--r--third_party/rust/neqo-http3/src/connection_server.rs17
-rw-r--r--third_party/rust/neqo-http3/src/recv_message.rs2
-rw-r--r--third_party/rust/neqo-http3/src/send_message.rs6
-rw-r--r--third_party/rust/neqo-http3/src/server_events.rs8
6 files changed, 35 insertions, 35 deletions
diff --git a/third_party/rust/neqo-http3/src/connection.rs b/third_party/rust/neqo-http3/src/connection.rs
index 287ea2c2af..dd45797baa 100644
--- a/third_party/rust/neqo-http3/src/connection.rs
+++ b/third_party/rust/neqo-http3/src/connection.rs
@@ -354,7 +354,7 @@ impl Http3Connection {
/// This function creates and initializes, i.e. send stream type, the control and qpack
/// streams.
fn initialize_http3_connection(&mut self, conn: &mut Connection) -> Res<()> {
- qinfo!([self], "Initialize the http3 connection.");
+ qdebug!([self], "Initialize the http3 connection.");
self.control_stream_local.create(conn)?;
self.send_settings();
@@ -386,8 +386,8 @@ impl Http3Connection {
Ok(())
}
- /// Inform a `HttpConnection` that a stream has data to send and that `send` should be called
- /// for the stream.
+ /// Inform an [`Http3Connection`] that a stream has data to send and that
+ /// [`SendStream::send`] should be called for the stream.
pub fn stream_has_pending_data(&mut self, stream_id: StreamId) {
self.streams_with_pending_data.insert(stream_id);
}
@@ -704,7 +704,7 @@ impl Http3Connection {
);
}
NewStreamType::Decoder => {
- qinfo!([self], "A new remote qpack encoder stream {}", stream_id);
+ qdebug!([self], "A new remote qpack encoder stream {}", stream_id);
self.check_stream_exists(Http3StreamType::Decoder)?;
self.recv_streams.insert(
stream_id,
@@ -715,7 +715,7 @@ impl Http3Connection {
);
}
NewStreamType::Encoder => {
- qinfo!([self], "A new remote qpack decoder stream {}", stream_id);
+ qdebug!([self], "A new remote qpack decoder stream {}", stream_id);
self.check_stream_exists(Http3StreamType::Encoder)?;
self.recv_streams.insert(
stream_id,
@@ -766,7 +766,7 @@ impl Http3Connection {
/// This is called when an application closes the connection.
pub fn close(&mut self, error: AppError) {
- qinfo!([self], "Close connection error {:?}.", error);
+ qdebug!([self], "Close connection error {:?}.", error);
self.state = Http3State::Closing(ConnectionError::Application(error));
if (!self.send_streams.is_empty() || !self.recv_streams.is_empty()) && (error == 0) {
qwarn!("close(0) called when streams still active");
@@ -952,7 +952,7 @@ impl Http3Connection {
stream_id: StreamId,
buf: &mut [u8],
) -> Res<(usize, bool)> {
- qinfo!([self], "read_data from stream {}.", stream_id);
+ qdebug!([self], "read_data from stream {}.", stream_id);
let res = self
.recv_streams
.get_mut(&stream_id)
@@ -1091,7 +1091,7 @@ impl Http3Connection {
/// This is called when an application wants to close the sending side of a stream.
pub fn stream_close_send(&mut self, conn: &mut Connection, stream_id: StreamId) -> Res<()> {
- qinfo!([self], "Close the sending side for stream {}.", stream_id);
+ qdebug!([self], "Close the sending side for stream {}.", stream_id);
debug_assert!(self.state.active());
let send_stream = self
.send_streams
@@ -1402,7 +1402,7 @@ impl Http3Connection {
/// `PriorityUpdateRequestPush` which handling is specific to the client and server, we must
/// give them to the specific client/server handler.
fn handle_control_frame(&mut self, f: HFrame) -> Res<Option<HFrame>> {
- qinfo!([self], "Handle a control frame {:?}", f);
+ qdebug!([self], "Handle a control frame {:?}", f);
if !matches!(f, HFrame::Settings { .. })
&& !matches!(
self.settings_state,
@@ -1433,7 +1433,7 @@ impl Http3Connection {
}
fn handle_settings(&mut self, new_settings: HSettings) -> Res<()> {
- qinfo!([self], "Handle SETTINGS frame.");
+ qdebug!([self], "Handle SETTINGS frame.");
match &self.settings_state {
Http3RemoteSettingsState::NotReceived => {
self.set_qpack_settings(&new_settings)?;
diff --git a/third_party/rust/neqo-http3/src/connection_client.rs b/third_party/rust/neqo-http3/src/connection_client.rs
index 52572a760d..4c8772d14a 100644
--- a/third_party/rust/neqo-http3/src/connection_client.rs
+++ b/third_party/rust/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,
@@ -590,7 +590,7 @@ impl Http3Client {
///
/// An error will be return if stream does not exist.
pub fn stream_close_send(&mut self, stream_id: StreamId) -> Res<()> {
- qinfo!([self], "Close sending side stream={}.", stream_id);
+ qdebug!([self], "Close sending side stream={}.", stream_id);
self.base_handler
.stream_close_send(&mut self.conn, stream_id)
}
@@ -652,7 +652,7 @@ impl Http3Client {
stream_id: StreamId,
buf: &mut [u8],
) -> Res<(usize, bool)> {
- qinfo!([self], "read_data from stream {}.", stream_id);
+ qdebug!([self], "read_data from stream {}.", stream_id);
let res = self.base_handler.read_data(&mut self.conn, stream_id, buf);
if let Err(e) = &res {
if e.connection_error() {
@@ -874,19 +874,16 @@ 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)
where
I: IntoIterator<Item = &'a Datagram>,
- I::IntoIter: ExactSizeIterator,
{
- let dgrams = dgrams.into_iter();
- qtrace!([self], "Process multiple datagrams, len={}", dgrams.len());
- if dgrams.len() == 0 {
+ let mut dgrams = dgrams.into_iter().peekable();
+ qtrace!([self], "Process multiple datagrams");
+ if dgrams.peek().is_none() {
return;
}
self.conn.process_multiple_input(dgrams, now);
diff --git a/third_party/rust/neqo-http3/src/connection_server.rs b/third_party/rust/neqo-http3/src/connection_server.rs
index 097209a226..cc887a26fc 100644
--- a/third_party/rust/neqo-http3/src/connection_server.rs
+++ b/third_party/rust/neqo-http3/src/connection_server.rs
@@ -64,13 +64,17 @@ impl Http3ServerHandler {
data: &[u8],
conn: &mut Connection,
) -> Res<usize> {
- self.base_handler.stream_has_pending_data(stream_id);
- self.needs_processing = true;
- self.base_handler
+ let n = self
+ .base_handler
.send_streams
.get_mut(&stream_id)
.ok_or(Error::InvalidStreamId)?
- .send_data(conn, data)
+ .send_data(conn, data)?;
+ if n > 0 {
+ self.base_handler.stream_has_pending_data(stream_id);
+ }
+ self.needs_processing = true;
+ Ok(n)
}
/// Supply response heeaders for a request.
@@ -98,9 +102,8 @@ impl Http3ServerHandler {
///
/// An error will be returned if stream does not exist.
pub fn stream_close_send(&mut self, stream_id: StreamId, conn: &mut Connection) -> Res<()> {
- qinfo!([self], "Close sending side stream={}.", stream_id);
+ qdebug!([self], "Close sending side stream={}.", stream_id);
self.base_handler.stream_close_send(conn, stream_id)?;
- self.base_handler.stream_has_pending_data(stream_id);
self.needs_processing = true;
Ok(())
}
@@ -408,7 +411,7 @@ impl Http3ServerHandler {
stream_id: StreamId,
buf: &mut [u8],
) -> Res<(usize, bool)> {
- qinfo!([self], "read_data from stream {}.", stream_id);
+ qdebug!([self], "read_data from stream {}.", stream_id);
let res = self.base_handler.read_data(conn, stream_id, buf);
if let Err(e) = &res {
if e.connection_error() {
diff --git a/third_party/rust/neqo-http3/src/recv_message.rs b/third_party/rust/neqo-http3/src/recv_message.rs
index be58b7e47c..55970849ef 100644
--- a/third_party/rust/neqo-http3/src/recv_message.rs
+++ b/third_party/rust/neqo-http3/src/recv_message.rs
@@ -271,7 +271,7 @@ impl RecvMessage {
}
(None, false) => break Ok(()),
(Some(frame), fin) => {
- qinfo!(
+ qdebug!(
[self],
"A new frame has been received: {:?}; state={:?} fin={}",
frame,
diff --git a/third_party/rust/neqo-http3/src/send_message.rs b/third_party/rust/neqo-http3/src/send_message.rs
index c50e3e056a..15965c44f6 100644
--- a/third_party/rust/neqo-http3/src/send_message.rs
+++ b/third_party/rust/neqo-http3/src/send_message.rs
@@ -6,7 +6,7 @@
use std::{cell::RefCell, cmp::min, fmt::Debug, rc::Rc};
-use neqo_common::{qdebug, qinfo, qtrace, Encoder, Header, MessageType};
+use neqo_common::{qdebug, qtrace, Encoder, Header, MessageType};
use neqo_qpack::encoder::QPackEncoder;
use neqo_transport::{Connection, StreamId};
@@ -119,7 +119,7 @@ impl SendMessage {
encoder: Rc<RefCell<QPackEncoder>>,
conn_events: Box<dyn SendStreamEvents>,
) -> Self {
- qinfo!("Create a request stream_id={}", stream_id);
+ qdebug!("Create a request stream_id={}", stream_id);
Self {
state: MessageState::WaitingForHeaders,
message_type,
@@ -193,7 +193,7 @@ impl SendStream for SendMessage {
min(buf.len(), available - 9)
};
- qinfo!(
+ qdebug!(
[self],
"send_request_body: available={} to_send={}.",
available,
diff --git a/third_party/rust/neqo-http3/src/server_events.rs b/third_party/rust/neqo-http3/src/server_events.rs
index a85ece0bfb..214a48c757 100644
--- a/third_party/rust/neqo-http3/src/server_events.rs
+++ b/third_party/rust/neqo-http3/src/server_events.rs
@@ -13,7 +13,7 @@ use std::{
rc::Rc,
};
-use neqo_common::{qdebug, qinfo, Encoder, Header};
+use neqo_common::{qdebug, Encoder, Header};
use neqo_transport::{
server::ActiveConnectionRef, AppError, Connection, DatagramTracking, StreamId, StreamType,
};
@@ -189,7 +189,7 @@ impl Http3OrWebTransportStream {
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
pub fn send_data(&mut self, data: &[u8]) -> Res<usize> {
- qinfo!([self], "Set new response.");
+ qdebug!([self], "Set new response.");
self.stream_handler.send_data(data)
}
@@ -199,7 +199,7 @@ impl Http3OrWebTransportStream {
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
pub fn stream_close_send(&mut self) -> Res<()> {
- qinfo!([self], "Set new response.");
+ qdebug!([self], "Set new response.");
self.stream_handler.stream_close_send()
}
}
@@ -270,7 +270,7 @@ impl WebTransportRequest {
///
/// It may return `InvalidStreamId` if a stream does not exist anymore.
pub fn response(&mut self, accept: &WebTransportSessionAcceptAction) -> Res<()> {
- qinfo!([self], "Set a response for a WebTransport session.");
+ qdebug!([self], "Set a response for a WebTransport session.");
self.stream_handler
.handler
.borrow_mut()