Skip to content
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.5.0-draft1"
version = "0.5.0-draft2"
edition = "2021"
license = "MIT OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/yoshuawuyts/wstd"
Expand Down Expand Up @@ -65,4 +65,4 @@ wasmtime = "26"
wasmtime-wasi = "26"
wasmtime-wasi-http = "26"
wstd = { path = "." }
wstd-macro = { path = "macro", version = "=0.5.0-draft1" }
wstd-macro = { path = "macro", version = "=0.5.0-draft2" }
6 changes: 3 additions & 3 deletions src/http/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::{response::IncomingBody, Body, Error, Request, Response, Result};
use crate::io::{self, AsyncOutputStream};
use crate::runtime::Reactor;
use crate::io::{self, AsyncOutputStream, AsyncPollable};
use crate::time::Duration;
use wasi::http::types::{OutgoingBody, RequestOptions as WasiRequestOptions};

Expand Down Expand Up @@ -34,7 +33,8 @@ impl Client {
OutgoingBody::finish(wasi_body, trailers).unwrap();

// 4. Receive the response
Reactor::current().wait_for(res.subscribe()).await;
AsyncPollable::new(res.subscribe()).wait_for().await;

// NOTE: the first `unwrap` is to ensure readiness, the second `unwrap`
// is to trap if we try and get the response more than once. The final
// `?` is to raise the actual error if there is one.
Expand Down
6 changes: 0 additions & 6 deletions src/runtime/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ impl Reactor {
}
ready
}

/// Wait for the pollable to resolve.
pub async fn wait_for(&self, pollable: Pollable) {
let p = self.schedule(pollable);
p.wait_for().await
}
}

#[cfg(test)]
Expand Down
Loading