Skip to content

Commit

Permalink
Merge pull request #147 from hapsoc/no-continuation-state
Browse files Browse the repository at this point in the history
feat: Remove continuation state, simplifies code greatly
  • Loading branch information
fasterthanlime authored Mar 12, 2024
2 parents ac07c0f + 324f999 commit 49e6d13
Show file tree
Hide file tree
Showing 11 changed files with 681 additions and 652 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Rust specified toolchain
run: rustup show
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Make sure things build
run: |
cargo build --profile ci
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Install Rust specified toolchain
run: rustup show
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Make sure things build
run: |
cargo build --profile ci
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Install Rust specified toolchain
run: rustup show
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Set up sccache (part 2)
run: sccache --start-server
- uses: taiki-e/install-action@v2
Expand Down
5 changes: 4 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test *args:
just build-testbed
RUST_BACKTRACE=1 cargo nextest run {{args}}

curl-tests:
RUST_BACKTRACE=1 cargo nextest run --manifest-path test-crates/fluke-curl-tests/Cargo.toml

build-testbed:
cargo build --release --manifest-path test-crates/hyper-testbed/Cargo.toml

Expand All @@ -32,7 +35,7 @@ bench *args:
h2spec *args:
#!/bin/bash -eux
export RUST_LOG="${RUST_LOG:-fluke=debug,fluke_hpack=info}"
export RUST_BACKTRACE=1
export RUST_BACKTRACE="${RUST_BACKTRACE:-1}"
cargo run --manifest-path test-crates/fluke-h2spec/Cargo.toml -- {{args}}

check:
Expand Down
2 changes: 1 addition & 1 deletion crates/fluke-buffet/src/piece.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use std::{fmt, ops::Deref, str::Utf8Error};

use http::header::HeaderName;
use fluke_maybe_uring::buf::IoBuf;
use http::header::HeaderName;

use crate::{Roll, RollStr};

Expand Down
1 change: 1 addition & 0 deletions crates/fluke/src/h2/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub(crate) enum PieceOrTrailers {
}

pub(crate) type H2BodySender = mpsc::Sender<H2BodyItem>;
// FIXME: don't use eyre, do proper error handling
pub(crate) type H2BodyItem = eyre::Result<PieceOrTrailers>;

#[derive(Debug)]
Expand Down
12 changes: 8 additions & 4 deletions crates/fluke/src/h2/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,23 @@ impl Frame {
}

/// See https://httpwg.org/specs/rfc9113.html#FrameHeader - the first bit
/// is reserved, and the rest is a 32-bit stream id
fn parse_reserved_and_stream_id(i: Roll) -> IResult<Roll, (u8, StreamId)> {
/// is reserved, and the rest is a 31-bit stream id
pub fn parse_reserved_and_u31(i: Roll) -> IResult<Roll, (u8, u32)> {
fn reserved(i: (Roll, usize)) -> IResult<(Roll, usize), u8> {
nom::bits::streaming::take(1_usize)(i)
}

fn stream_id(i: (Roll, usize)) -> IResult<(Roll, usize), StreamId> {
nom::combinator::map(nom::bits::streaming::take(31_usize), StreamId)(i)
fn stream_id(i: (Roll, usize)) -> IResult<(Roll, usize), u32> {
nom::bits::streaming::take(31_usize)(i)
}

nom::bits::bits(tuple((reserved, stream_id)))(i)
}

fn parse_reserved_and_stream_id(i: Roll) -> IResult<Roll, (u8, StreamId)> {
parse_reserved_and_u31(i).map(|(i, (reserved, stream_id))| (i, (reserved, StreamId(stream_id))))
}

// cf. https://httpwg.org/specs/rfc9113.html#HEADERS
#[derive(Debug)]
pub(crate) struct PrioritySpec {
Expand Down
Loading

0 comments on commit 49e6d13

Please sign in to comment.