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

refactor(iroh-net): remove unneeded async interactions with the magicsock actor #2058

Merged
merged 6 commits into from
Mar 6, 2024

Conversation

Frando
Copy link
Member

@Frando Frando commented Mar 6, 2024

Description

While working on #2056 I spotted that we use the actor inbox with return channels for information that is readily available already on the shared inner magicsock. This removes the unneeded complexity and thus simplifies get_mapping_addr, endpoint_info and endpoint_infos to return the information non-async and infallible. Yay!

Notes & open questions

Change checklist

  • Self-review.

@Frando Frando changed the title refactor: remove unneeded async interactions with the magicsock actor refactor(iroh-net): remove unneeded async interactions with the magicsock actor Mar 6, 2024
iroh/src/node.rs Outdated
self,
req: NodeConnectionInfoRequest,
) -> RpcResult<NodeConnectionInfoResponse> {
) -> impl Future<Output = RpcResult<NodeConnectionInfoResponse>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

why the change from async to impl Future?

Copy link
Member Author

@Frando Frando Mar 6, 2024

Choose a reason for hiding this comment

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

Because otherwise clippy says Warning: unused 'async' for function with no await statements. Also maybe it makes it obvious that there is no await. Can also add a clippy allow, if preferred? Don't mind.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed it to return std::future::Ready directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer clippy allow, with a comment why it is an async function, to avoid confusion when reading the code later

Cargo.lock Outdated
@@ -2429,6 +2429,7 @@ dependencies = [
"bytes",
"clap",
"criterion",
"crypto_box",
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this changing?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe current main has this wrong after #2053

@Frando Frando enabled auto-merge March 6, 2024 13:47
@Frando Frando added this pull request to the merge queue Mar 6, 2024
Merged via the queue into main with commit a42c1b2 Mar 6, 2024
20 checks passed
@dignifiedquire dignifiedquire deleted the refactor/magicsock-less-actormsgs branch March 6, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants