From 0eded23338158743e15b68b4834506c960ada37a Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sat, 28 Dec 2024 13:15:26 -0800 Subject: [PATCH 1/3] fixup: forgot to commit change of http::Client to use AsyncPollable to #37 --- src/http/client.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http/client.rs b/src/http/client.rs index 552d740..d064765 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -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}; @@ -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. From 0bbf0b7b5082363b96addc92eb093086158d8259 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sat, 28 Dec 2024 13:16:16 -0800 Subject: [PATCH 2/3] eliminate Reactor::wait_for everyone should use AsyncPollable::wait_for. --- src/runtime/reactor.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/runtime/reactor.rs b/src/runtime/reactor.rs index afd001d..44b972a 100644 --- a/src/runtime/reactor.rs +++ b/src/runtime/reactor.rs @@ -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)] From e9549d784d26f914a6d167bcde1e8a48cb39f406 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sat, 28 Dec 2024 13:16:55 -0800 Subject: [PATCH 3/3] bump version to 0.5.0-draft2 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2acea92..74e2e39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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" }