Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a regression with wasmtime serve, and enable the serve feature in tests #7137

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cargo test \
--features wasi-threads \
--features wasi-http \
--features component-model \
--features serve \
--workspace \
--exclude 'wasmtime-wasi-*' \
--exclude wasi-tests \
Expand Down
15 changes: 6 additions & 9 deletions src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ struct Host {
}

impl Host {
fn new() -> Result<Self> {
let mut table = Table::new();
let ctx = WasiCtxBuilder::new().build(&mut table)?;
Ok(Host {
table,
ctx,
fn new() -> Self {
Host {
table: Table::new(),
ctx: WasiCtxBuilder::new().build(),
http: WasiHttpCtx,
})
}
}
}

Expand Down Expand Up @@ -168,8 +166,7 @@ impl hyper::service::Service<Request> for ProxyHandler {

// TODO: need to track the join handle, but don't want to block the response on it
tokio::task::spawn(async move {
let host = Host::new()?;
let mut store = Store::new(&handler.engine, host);
let mut store = Store::new(&handler.engine, Host::new());

let req = store.data_mut().new_incoming_request(
req.map(|body| body.map_err(|e| anyhow::anyhow!(e)).boxed()),
Expand Down