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

Amends https://github.com/smol-dot/smoldot/pull/407 to properly fix the issue #410

Merged
merged 1 commit into from
Apr 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
30 changes: 25 additions & 5 deletions light-base/src/json_rpc_service/background/state_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

'main_sub_loop: loop {
let mut new_blocks = {
Expand Down Expand Up @@ -583,7 +587,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -713,7 +721,11 @@ impl<TPlat: Platform> Background<TPlat> {
)
.await;

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -1428,7 +1440,11 @@ impl<TPlat: Platform> Background<TPlat> {
let spec_changes = stream::iter(iter::once(current_spec)).chain(spec_changes);
futures::pin_mut!(spec_changes);

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down Expand Up @@ -1687,7 +1703,11 @@ impl<TPlat: Platform> Background<TPlat> {

futures::pin_mut!(storage_updates);

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ impl<TPlat: Platform> Background<TPlat> {

// TODO: doesn't reported `validated` events

let requests_subscriptions = Arc::downgrade(&requests_subscriptions);
let requests_subscriptions = {
let weak = Arc::downgrade(&requests_subscriptions);
drop(requests_subscriptions);
weak
};

loop {
let event = {
Expand Down