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

autonat: Clean up after close #2749

Merged
merged 2 commits into from
Mar 28, 2024
Merged

autonat: Clean up after close #2749

merged 2 commits into from
Mar 28, 2024

Conversation

MarcoPolo
Copy link
Collaborator

Autonat would leave a couple of dangling go routines because it wouldn't close the swarm or the peerstore. Fixes #2743.

p2p/host/autonat/autonat.go Outdated Show resolved Hide resolved
Comment on lines +276 to +280
func (as *autoNATService) Close() error {
as.Disable()
return as.config.dialer.Close()
}

Copy link
Member

Choose a reason for hiding this comment

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

Should we just close the dialer from the autonat instance? That seems better, we ensure that the dialer is always closed even if for some reason there's an issue with service being set to nil for some reason.
I don't have strong opinions here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My read here is that the dialer is owned by the service, so it's the service's responsibility to close it.

@MarcoPolo MarcoPolo merged commit 86a6720 into master Mar 28, 2024
11 checks passed
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.

AutoNAT fails to close its peerstore
2 participants