Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

add a Close method, remove the context from the constructor #141

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

marten-seemann
Copy link
Contributor

By implementing io.Closer, we make sure that the swarm will call Close when it's shutting down: https://github.com/libp2p/go-libp2p-swarm/blob/b035b90f5330de123747fe32afb3c2361f3ec0bc/swarm.go#L197-L204

Note that this PR isn't implementing a clean shutdown: it doesn't make sure that all Go routines created by are actually stopped. It's not worth the effort, given that we're going to deprecate this package soon anyway.

@Stebalien
Copy link
Member

I'll let @vyzo review first.

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.

It doesn't do much, but I agree let's not cry over spilled milk for soon to be deprecated code.

@marten-seemann marten-seemann merged commit d3d7cd6 into master Sep 9, 2021
@marten-seemann marten-seemann deleted the closing branch September 21, 2021 17:48
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.

3 participants