-
Notifications
You must be signed in to change notification settings - Fork 83
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
Dispose UdpClient instances when disposing MulticastService #94
base: master
Are you sure you want to change the base?
Conversation
…hen disposing MulticastService Since UdpClient implements IDisposable, and unicastClientIp4 and unicastClientIp6 are members of the MulticastService class, these instances must be disposed when disposing the MulticastService instance.
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
- Coverage 91.11% 90.57% -0.55%
==========================================
Files 10 10
Lines 518 520 +2
==========================================
- Hits 472 471 -1
- Misses 46 49 +3
Continue to review full report at Codecov.
|
Instead of disposing the UpdClient instances in the Stop method, they've been moved to the Dispose method. Reasoning here is that it should be possible to Stop and Start the MulticastService instance again.
Kind reminder @richardschneider |
I think the NetworkAddressChanged callback needs to be removed as well in the Stop() method: #if NET461 |
To me it also looks like the NetworkAddressChanged callback will update the clients to send/receive upd on, but it will not update the address list used in the response. Those addresses can be specified when creating a ServiceProfile to Advertise, and ends up in the NameServer.Catalog. |
Since I subscribe to NetworkAddressChanged myself, and re-advertise, the solution for the memory leakage was to remove all use of NetworkAddressChanged from the mdns code. Be aware that NetworkAddressChanged is called twice for every change if you have both ipv4 and ipv6 enabled, so make sure you don't re-advertise too much, or from different threads... |
Since UdpClient implements IDisposable, and unicastClientIp4 and unicastClientIp6 are members of the MulticastService class, these instances must be disposed when disposing the MulticastService instance.
See issue 93