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

don't use the context to shut down the relay #1184

Merged
merged 1 commit into from
Sep 13, 2021
Merged

Conversation

marten-seemann
Copy link
Contributor

Not a big fan of this change. I'd have preferred to save the AutoRelay on the BasicHost, but that's not possible (import cycle).

Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

I don't like this proliferation of host wrappers either -- can't we just save the close function in the host and invoke that?
We can even compose multiple close functions into one this way for all dependent services.

@marten-seemann
Copy link
Contributor Author

I thought of that, but I’m not sure if having a SetClose(closeFunc) method on the Host is nicer.

@vyzo
Copy link
Contributor

vyzo commented Sep 10, 2021 via email

@vyzo
Copy link
Contributor

vyzo commented Sep 10, 2021 via email

@marten-seemann
Copy link
Contributor Author

We can’t put it in the constructor, as the autonat depends on the host.

Let’s keep wrapping for now, I think that’s the more idiomatic way to handle this in Go anyway.

@vyzo
Copy link
Contributor

vyzo commented Sep 10, 2021 via email

Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

actually I'll give the blessing; I am allergic to host wrapping, but on the same time I can't think of any really good reason not to wrap, so let's do it.

We should have the discussion about services at some point, so that we can eliminate wrapping altogether in the future.

@Stebalien
Copy link
Member

Can I not pass in a set of abstract "service" constructors into the host? Of the form func(Host) (io.Closer, error)?

(note: fx/dependency injection would also fix this, we really need a way to "manage" libp2p services).

@marten-seemann
Copy link
Contributor Author

Can I not pass in a set of abstract "service" constructors into the host? Of the form func(Host) (io.Closer, error)?

I'd love to do this. We just need to figure out a way to pass options to that constructor.

@marten-seemann marten-seemann merged commit 9d3fd8b into master Sep 13, 2021
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
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.

3 participants