Skip to content

Commit bce7e24

Browse files
committed
Work around sockets syncness change
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
1 parent 8edfa14 commit bce7e24

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

crates/factor-wasi/src/sockets.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ impl<T> p3_HostUdpSocket for SpinSocketsView<'_, T> {
836836
}
837837
}
838838

839-
impl<T: 'static> HostTcpSocketWithStore<T> for SpinSockets<T> {
839+
impl<T: Send + 'static> HostTcpSocketWithStore<T> for SpinSockets<T> {
840840
async fn connect(
841841
store: &Accessor<T, Self>,
842842
socket: Resource<p3_types::TcpSocket>,
@@ -868,13 +868,13 @@ impl<T: 'static> HostTcpSocketWithStore<T> for SpinSockets<T> {
868868
result
869869
}
870870

871-
fn listen(
871+
async fn listen(
872872
mut store: Access<'_, T, Self>,
873873
socket: Resource<p3_types::TcpSocket>,
874874
) -> P3SocketResult<wasmtime::component::StreamReader<Resource<p3_types::TcpSocket>>> {
875875
let getter = store.get().getter;
876876
let wasi_store = Access::<T, WasiSockets>::new(store.as_context_mut(), getter);
877-
<WasiSockets as HostTcpSocketWithStore<T>>::listen(wasi_store, socket)
877+
<WasiSockets as HostTcpSocketWithStore<T>>::listen(wasi_store, socket).await
878878
}
879879

880880
fn send(

crates/factor-wasi/src/wasi_2026_03_15.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ mod bindings {
3636
"wasi:filesystem/types.[method]descriptor.append-via-stream": store | trappable,
3737
"wasi:filesystem/types.[method]descriptor.read-directory": store | trappable,
3838
"wasi:sockets/types.[method]tcp-socket.bind": async | trappable,
39-
"wasi:sockets/types.[method]tcp-socket.listen": store | trappable,
39+
"wasi:sockets/types.[method]tcp-socket.listen": async | store | trappable,
4040
"wasi:sockets/types.[method]tcp-socket.send": store | trappable,
4141
"wasi:sockets/types.[method]tcp-socket.receive": store | trappable,
4242
"wasi:sockets/types.[method]udp-socket.bind": async | trappable,
@@ -823,7 +823,7 @@ impl<T: Send + 'static> wasi::sockets::types::HostTcpSocketWithStore<T> for Spin
823823
)
824824
}
825825

826-
fn listen(
826+
async fn listen(
827827
store: Access<'_, T, Self>,
828828
socket: Resource<wasi::sockets::types::TcpSocket>,
829829
) -> wasmtime::Result<
@@ -832,9 +832,7 @@ impl<T: Send + 'static> wasi::sockets::types::HostTcpSocketWithStore<T> for Spin
832832
wasi::sockets::types::ErrorCode,
833833
>,
834834
> {
835-
convert_result(latest::sockets::types::HostTcpSocketWithStore::listen(
836-
store, socket,
837-
))
835+
convert_result(latest::sockets::types::HostTcpSocketWithStore::listen(store, socket).await)
838836
}
839837

840838
fn send(

0 commit comments

Comments
 (0)