Skip to content

Commit

Permalink
fix(Dispose): stop the senders and receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Mar 6, 2019
1 parent 6ab780d commit 8399144
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Mdns.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
appveyor.yml = appveyor.yml
.circleci\config.yml = .circleci\config.yml
LICENSE = LICENSE
mung.cmd = mung.cmd
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -21,7 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MdnsTests", "test\MdnsTests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spike", "Spike\Spike.csproj", "{B7019D35-A153-4143-979C-C493A74FA7EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Browser", "Browser\Browser.csproj", "{A77BEF8C-440E-46F7-ACFC-5EF06EFCA4BA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Browser", "Browser\Browser.csproj", "{A77BEF8C-440E-46F7-ACFC-5EF06EFCA4BA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 6 additions & 0 deletions mung.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dotnet build -c Release --framework netcoreapp2 ./test

:Loop
dotnet test --logger "console;verbosity=normal" -c Release --no-restore --no-build --framework netcoreapp2 ./test --filter TestCategory!=IPv6
if %errorlevel% equ 0 goto :Loop
echo Connection established
4 changes: 4 additions & 0 deletions src/MulticastClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
MessageReceived = null;

foreach (var receiver in receivers)
{
receiver.Dispose();
}
receivers.Clear();

foreach (var address in senders.Keys)
{
Expand All @@ -186,6 +189,7 @@ protected virtual void Dispose(bool disposing)
sender.Dispose();
}
}
senders.Clear();
}

disposedValue = true;
Expand Down

0 comments on commit 8399144

Please # to comment.