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

switch directions #2285

Closed
wants to merge 1 commit into from
Closed

Conversation

dignifiedquire
Copy link
Contributor

No description provided.

.accept_mode(AcceptMode::Manual { alpns })
.accept_mode(AcceptMode::Manual {
alpns,
cb: Box::new(|node, mut connecting| {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if your protocol handlers need an endpoint to do something time based outside this callback?

When manually driving the loop this is easy, just get the endpoint from the node. With this approach, I guess you would have to grab the endpoint from the node on the first call of this fn, and then put it into some Arc<Mutex<...>>. But then, is it always the same node and always the same endpoint? Is it safe to store the node somewhere? The function signature does not say.

Imagine you wanted to use gossip as a separate custom protocol. Using it using this callback would be a major pain, since the constructor needs an endpoint.

https://docs.rs/iroh-gossip/latest/iroh_gossip/net/struct.Gossip.html#method.from_endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants