Skip to content

Commit

Permalink
[Optimize] Avoid poll writeable hang forever
Browse files Browse the repository at this point in the history
Signed-off-by: csh <[email protected]>
  • Loading branch information
L-jasmine committed Jul 29, 2024
1 parent ab1661c commit ac7a128
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/async-wasi/src/snapshots/common/net/async_tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ pub(crate) struct SocketWritable(pub(crate) AtomicI8);
impl SocketWritable {
pub(crate) async fn writable(&self) {
let b = self.0.fetch_sub(1, std::sync::atomic::Ordering::Acquire);
SocketWritableFuture(b).await;
tokio::time::timeout(Duration::from_secs(10), SocketWritableFuture(b)).await;
}

pub(crate) fn set_writable(&self) {
self.0.store(2, std::sync::atomic::Ordering::Release)
self.0.store(5, std::sync::atomic::Ordering::Release)
}
}
impl Default for SocketWritable {
fn default() -> Self {
Self(AtomicI8::new(2))
Self(AtomicI8::new(5))
}
}

Expand Down

0 comments on commit ac7a128

Please sign in to comment.