Skip to content

Commit

Permalink
Fix a regression with wasmtime serve, and enable the serve feature …
Browse files Browse the repository at this point in the history
…in tests (bytecodealliance#7137)
  • Loading branch information
elliottt authored and eduardomourar committed Oct 4, 2023
1 parent b2227c5 commit cdf4859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
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

0 comments on commit cdf4859

Please sign in to comment.