Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

await on join #2137

Merged
merged 6 commits into from
Feb 28, 2020
Merged

await on join #2137

merged 6 commits into from
Feb 28, 2020

Conversation

freesig
Copy link
Contributor

@freesig freesig commented Feb 28, 2020

PR summary

This awaits on the new connection future instead of just spawning it because otherwise the Lib3hToClient::HandleGetGossipingEntryList and Lib3hToClient::HandleGetAuthoringEntryList messages get sent and can be responded to before the join is complete. This leads to the responses to those messages being thrown away. Then the agents id's never actually get into the DHT.

testing/benchmarking notes

( if any manual testing or benchmarking was/should be done, add notes and/or screenshots here )

followups

( any new tickets/concerns that were discovered or created during this work but aren't in scope for review here )

changelog

  • if this is a code change that effects some consumer (e.g. zome developers) of holochain core, then it has been added to our between-release changelog with the format
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)

documentation

Copy link
Collaborator

@lucksus lucksus left a comment

Choose a reason for hiding this comment

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

👏 👏 👏

let f = self.new_connection(space_hash, agent_id, uri);
tokio::task::spawn(f);
f.await
Copy link
Contributor

Choose a reason for hiding this comment

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

My intention was that functions prefixed with spawn_ would not return futures (or anything else) because they spawn the task.

If we don't need this, we can just delete this whole function - and lib.rs can call new_connection() directly : )

@@ -522,17 +531,20 @@ fn spawn_handle_message_hello(
}
}

fn spawn_handle_message_join_space(
async fn spawn_handle_message_join_space(
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly, remove the spawn_ prefix here if that's not what we're doing.

Copy link
Contributor

@neonphog neonphog left a comment

Choose a reason for hiding this comment

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

couple cosmetic name change suggestions - but this looks awesome : )

Nice find! 👍

Copy link
Member

@zippy zippy left a comment

Choose a reason for hiding this comment

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

Approved with the naming changes so that we keep functions consistently named to intent. WOOT!

crates/sim2h/src/lib.rs Outdated Show resolved Hide resolved
@zippy zippy merged commit 79fd68a into develop Feb 28, 2020
@neonphog neonphog deleted the fix_5000 branch February 28, 2020 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants