Skip to content

Commit

Permalink
Properly fix the when_wake_up system (#1026)
Browse files Browse the repository at this point in the history
* Properly fix the `when_wake_up` system

* PR link
  • Loading branch information
tomaka authored Aug 11, 2023
1 parent 48864e7 commit 1986f83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
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

0 comments on commit 1986f83

Please sign in to comment.