Skip to content

Commit

Permalink
fix: more thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Mar 7, 2018
1 parent f1945c5 commit 2aeacad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/MulticastService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,15 @@ void FindNetworkInterfaces(object state)
// Tell others.
if (nics.Length > 0)
{
NetworkInterfaceDiscovered?.Invoke(this, new NetworkInterfaceEventArgs
lock (socketLock)
{
NetworkInterfaces = nics
});
if (socket == null || nicTimer == null)
return;
NetworkInterfaceDiscovered?.Invoke(this, new NetworkInterfaceEventArgs
{
NetworkInterfaces = nics
});
}
}
}

Expand Down

0 comments on commit 2aeacad

Please sign in to comment.