Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly fix the when_wake_up system #1026

Merged
merged 2 commits into from
Aug 11, 2023
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
2 changes: 1 addition & 1 deletion wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- The block announces substream handshake of a parachain peer-to-peer network now properly contains the block that smoldot thinks is the best. The genesis block was previously always reported. ([#1012](https://github.com/smol-dot/smoldot/pull/1012))
- Fix panic when removing a chain while a networking connection is being opened. ([#1011](https://github.com/smol-dot/smoldot/pull/1011))
- Fix epoch start slot calculation when epochs have been skipped. ([#1015](https://github.com/smol-dot/smoldot/pull/1015))
- Fix timeouts not working properly in the networking. ([#1023](https://github.com/smol-dot/smoldot/pull/1023))
- Fix timeouts not working properly in the networking. ([#1023](https://github.com/smol-dot/smoldot/pull/1023), [#1026](https://github.com/smol-dot/smoldot/pull/1026))

## 1.0.15 - 2023-08-08

Expand Down
28 changes: 18 additions & 10 deletions wasm-node/rust/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,24 @@ impl smoldot_light::platform::PlatformRef for PlatformRef {
stream_inner.something_happened.listen()
};

listener
.or(async {
if let Some(when_wake_up) = stream.when_wake_up.as_mut() {
when_wake_up.await;
stream.when_wake_up = None;
} else {
future::pending().await
}
})
.await
let timer_stop = async move {
listener.await;
false
}
.or(async {
if let Some(when_wake_up) = stream.when_wake_up.as_mut() {
when_wake_up.await;
stream.when_wake_up = None;
true
} else {
future::pending().await
}
})
.await;

if timer_stop {
return;
}
}
})
}
Expand Down