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

Fixes connection leak and endless loop when context error is deadline exceeded (context with timeout) #55

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

eelcocramer
Copy link
Contributor

I ran onto an issue where I created repeating cancellable mDNS lookups.

I was using a context.WithTimeout to lookup DNS-SD entries but the read loop only checked for context.Cancelled which resulted in an endless loop when the error function return context. DeadlineExceeded.

I changed the context check to any error value as the function should always stop regardless of the error reason on the context.

Additionally I noticed that you are not closing the net.UDPConn used to create the PacketConns op. These are not closed automatically when closing these PacketConns.

This PR will likely close issue #32. It did for us.

context error is deadline exceeded.
@brutella
Copy link
Owner

Looks good to me. Thanks for the fix.

@brutella brutella merged commit 0021712 into brutella:master Dec 12, 2024
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.

2 participants