Skip to content

Commit

Permalink
Merge branch 'Main' into poll-incoming
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2424 committed Jun 21, 2024
2 parents a80b048 + 983c853 commit 4d8bf81
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/PROPOSAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This describes an effort to provide HTTP/3 support for the [hyper.rs](http://hyp

## 1. Goals

What would be the goals of this effort, and what wouldnt be.
What would be the goals of this effort, and what wouldn't be.

- Provide a standalone HTTP/3 crate.
- This is similar to what we did with `h2`. This allows folks that want more control over HTTP/3 specifically to be able to do so. Or people may wish to reduce their dependencies to the bare minimum, and thus don’t want to include crates supporting HTTP/1 and 2 (like `hyper` does).
Expand Down
4 changes: 2 additions & 2 deletions examples/webtransport_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// WebTransportSession::accept(h3_conn).await.unwrap();
// tracing::info!("Finished establishing webtransport session");
// // 4. Get datagrams, bidirectional streams, and unidirectional streams and wait for client requests here.
// // h3_conn needs to handover the datagrams, bidirectional streams, and unidirectional streams to the webtransport session.
// // h3_conn needs to hand over the datagrams, bidirectional streams, and unidirectional streams to the webtransport session.
// let result = handle.await;
}
Err(err) => {
Expand Down Expand Up @@ -177,7 +177,7 @@ async fn handle_connection(mut conn: Connection<h3_quinn::Connection<Bytes>, Byt
let session = WebTransportSession::accept(req, stream, conn).await?;
tracing::info!("Established webtransport session");
// 4. Get datagrams, bidirectional streams, and unidirectional streams and wait for client requests here.
// h3_conn needs to handover the datagrams, bidirectional streams, and unidirectional streams to the webtransport session.
// h3_conn needs to hand over the datagrams, bidirectional streams, and unidirectional streams to the webtransport session.
handle_session_and_echo_all_inbound_messages(session).await?;

return Ok(());
Expand Down
12 changes: 6 additions & 6 deletions h3/src/client/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use super::stream::RequestStream;
/// This struct is cloneable so multiple requests can be sent concurrently.
///
/// Existing instances are atomically counted internally, so whenever all of them have been
/// dropped, the connection will be automatically closed whith HTTP/3 connection error code
/// dropped, the connection will be automatically closed with HTTP/3 connection error code
/// `HTTP_NO_ERROR = 0`.
///
/// # Examples
Expand Down Expand Up @@ -120,7 +120,7 @@ where
T: quic::OpenStreams<B>,
B: Buf,
{
/// Send a HTTP/3 request to the server
/// Send an HTTP/3 request to the server
pub async fn send_request(
&mut self,
req: http::Request<()>,
Expand Down Expand Up @@ -247,9 +247,9 @@ where
/// Client connection driver
///
/// Maintains the internal state of an HTTP/3 connection, including control and QPACK.
/// It needs to be polled continously via [`poll_close()`]. On connection closure, this
/// It needs to be polled continuously via [`poll_close()`]. On connection closure, this
/// will resolve to `Ok(())` if the peer sent `HTTP_NO_ERROR`, or `Err()` if a connection-level
/// error occured.
/// error occurred.
///
/// [`shutdown()`] initiates a graceful shutdown of this connection. After calling it, no request
/// initiation will be further allowed. Then [`poll_close()`] will resolve when all ongoing requests
Expand All @@ -258,7 +258,7 @@ where
///
/// # Examples
///
/// ## Drive a connection concurrenty
/// ## Drive a connection concurrently
///
/// ```rust
/// # use bytes::Buf;
Expand Down Expand Up @@ -318,7 +318,7 @@ where
/// Ok::<(), Box<dyn std::error::Error + Send + Sync>>(())
/// });
///
/// // Do client things, wait for close contition...
/// // Do client things, wait for close condition...
///
/// // Initiate shutdown
/// shutdown_tx.send(2);
Expand Down
10 changes: 5 additions & 5 deletions h3/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ where
Poll::Pending => return Poll::Pending,
Poll::Ready(Err(_)) => {
// could not create grease stream
// dont try again
// don't try again
self.send_grease_stream_flag = false;
warn!("grease stream creation failed with");
return Poll::Ready(());
Expand Down Expand Up @@ -641,7 +641,7 @@ where
Poll::Pending => return Poll::Pending,
Poll::Ready(Err(_)) => {
// could not write grease frame
// dont try again
// don't try again
self.send_grease_stream_flag = false;
warn!("write data on grease stream failed with");
return Poll::Ready(());
Expand All @@ -668,7 +668,7 @@ where
Poll::Pending => return Poll::Pending,
Poll::Ready(Err(_)) => {
// could not finish grease stream
// dont try again
// don't try again
self.send_grease_stream_flag = false;
warn!("finish grease stream failed with");
return Poll::Ready(());
Expand All @@ -678,7 +678,7 @@ where
};

// grease stream is closed
// dont do another one
// don't do another one
self.send_grease_stream_flag = false;
Poll::Ready(())
}
Expand Down Expand Up @@ -899,7 +899,7 @@ where
Ok(())
}

/// Stops an stream with an error code
/// Stops a stream with an error code
pub fn stop_stream(&mut self, code: Code) {
self.stream.reset(code.into());
}
Expand Down
2 changes: 1 addition & 1 deletion h3/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Error {
}

/// returns the [`ErrorLevel`] of an [`Error`]
/// This indicates weather a accept loop should continue.
/// This indicates weather an accept loop should continue.
pub fn get_error_level(&self) -> ErrorLevel {
match self.inner.kind {
Kind::Application {
Expand Down
2 changes: 1 addition & 1 deletion h3/src/proto/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ impl fmt::Display for SettingsError {
match self {
SettingsError::Exceeded => write!(
f,
"max settings number exeeded, check for duplicate entries"
"max settings number exceeded, check for duplicate entries"
),
SettingsError::Malformed => write!(f, "malformed settings frame"),
SettingsError::Repeated(id) => write!(f, "got setting 0x{:x} twice", id.0),
Expand Down
2 changes: 1 addition & 1 deletion h3/src/proto/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Header {

Ok((
self.pseudo.method.ok_or(HeaderError::MissingMethod)?,
// When empty host field is built into a uri it fails
// When empty host field is built into an uri it fails
//= https://www.rfc-editor.org/rfc/rfc9114#section-4.3.1
//# If these fields are present, they MUST NOT be
//# empty.
Expand Down
2 changes: 1 addition & 1 deletion h3/src/qpack/prefix_string/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl HuffmanEncoder {
let forward =
end_range.byte as usize - self.buffer.len() + if end_range.bit > 0 { 1 } else { 0 };
for _ in 0..forward {
// push filler value that will ends huffman decoding if not
// push filler value that will end huffman decoding if not
// modified
self.buffer.push(255);
}
Expand Down
6 changes: 3 additions & 3 deletions h3/src/qpack/vas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/*
* # Virtually infinite address space mapper.
*
* It can be described as a infinitively growable list, with a visibility
* It can be described as an infinitive growable list, with a visibility
* window that can only move in the direction of insertion.
*
* Origin Visible window
Expand All @@ -34,7 +34,7 @@
* pos: real index in memory container
* pst: post-base relative index (only with base index)
*
* first oldest lastest
* first oldest latest
* element insertion insertion
* (not available available
* available) | |
Expand All @@ -52,7 +52,7 @@
*
* # Base index
* A base index can arbitrary shift the relative index.
* The base index itself is a absolute index.
* The base index itself is an absolute index.
*
* base index: 17
* |
Expand Down
4 changes: 2 additions & 2 deletions h3/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub trait SendStream<B: Buf> {

/// Allows sending unframed pure bytes to a stream. Similar to [`AsyncWrite`](https://docs.rs/tokio/latest/tokio/io/trait.AsyncWrite.html)
pub trait SendStreamUnframed<B: Buf>: SendStream<B> {
/// Attempts write data into the stream.
/// Attempts to write data into the stream.
///
/// Returns the number of bytes written.
///
Expand All @@ -162,7 +162,7 @@ pub trait RecvStream {

/// Poll the stream for more data.
///
/// When the receive side will no longer receive more data (such as because
/// When the receiving side will no longer receive more data (such as because
/// the peer closed their sending side), this should return `None`.
fn poll_data(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion h3/src/server/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ where
}
}

/// Accepts an http request where the first frame has already been read and decoded.
/// Accepts a http request where the first frame has already been read and decoded.
///
///
/// This is needed as a bidirectional stream may be read as part of incoming webtransport
Expand Down
2 changes: 1 addition & 1 deletion h3/src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::stream::RequestStream;

pub struct ResolveRequest<C: quic::Connection<B>, B: Buf> {
request_stream: RequestStream<C::BidiStream, B>,
// Ok or `REQUEST_HEADER_FIELDS_TO_LARGE` which neeeds to be sent
// Ok or `REQUEST_HEADER_FIELDS_TO_LARGE` which needs to be sent
decoded: Result<qpack::Decoded, u64>,
max_field_section_size: u64,
}
Expand Down
4 changes: 2 additions & 2 deletions h3/src/tests/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async fn server_drop_close() {
}

// In this test the client calls send_data() without doing a finish(),
// i.e client keeps the body stream open. And cient expects server to
// i.e client keeps the body stream open. And client expects server to
// read_data() and send a response
#[tokio::test]
async fn server_send_data_without_finish() {
Expand Down Expand Up @@ -385,7 +385,7 @@ async fn control_close_send_error() {
//# error of type H3_CLOSED_CRITICAL_STREAM.
control_stream.finish().unwrap(); // close the client control stream immediately

// create the Connection manually so it does not open a second Control stream
// create the Connection manually, so it does not open a second Control stream

let connection_error = loop {
let accepted = connection.accept_bi().await;
Expand Down
2 changes: 1 addition & 1 deletion h3/src/tests/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ async fn get_timeout_client_recv_response() {
let mut incoming_req = server::Connection::new(conn).await.unwrap();

// _req must not be dropped, else the connection will be closed and the timeout
// wont be triggered
// won't be triggered
let _req = incoming_req.accept().await.expect("accept").unwrap();
tokio::time::sleep(Duration::from_millis(500)).await;
};
Expand Down

0 comments on commit 4d8bf81

Please sign in to comment.