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

Make sure guard is not considered unused #4642

Merged
merged 1 commit into from
Sep 15, 2022
Merged

Conversation

mystenmark
Copy link
Contributor

No description provided.

@andll
Copy link
Contributor

andll commented Sep 15, 2022

@mystenmark I think this part of code is very suspicious.
In Ok() branch we spawn the task and run state.handle_messages, in Err() branch we spawn the task and take the guard and then drop it. Does it make more sense to just drop this logic entirely and do something like

let mut receiver = state.receiver.clone().try_lock_owned().expect("Duplicate call to NodeSyncState::start() "); // 

@mystenmark
Copy link
Contributor Author

We could. But I was very scared of putting an unwrap() into the validator that is never called. It's much scarier than putting in an unwrap() that is called and you know is safe. I don't know how to prove that nothing in the code will ever make a duplicate call to the start function.

Copy link
Contributor

@andll andll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but it is still strange piece of code :/

@mystenmark mystenmark merged commit e1e1c94 into main Sep 15, 2022
@mystenmark mystenmark deleted the mlogan-fix-warning branch September 15, 2022 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants