mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Merge pull request #5359 from cvium/fix_broadcasttimer_disposed
Do nothing in timer callback when device locator is disposed
This commit is contained in:
commit
72d063c563
1 changed files with 6 additions and 8 deletions
|
@ -97,6 +97,11 @@ namespace Rssdp.Infrastructure
|
||||||
|
|
||||||
private async void OnBroadcastTimerCallback(object state)
|
private async void OnBroadcastTimerCallback(object state)
|
||||||
{
|
{
|
||||||
|
if (IsDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StartListeningForNotifications();
|
StartListeningForNotifications();
|
||||||
RemoveExpiredDevicesFromCache();
|
RemoveExpiredDevicesFromCache();
|
||||||
|
|
||||||
|
@ -180,8 +185,6 @@ namespace Rssdp.Infrastructure
|
||||||
/// <exception cref="ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> ty is true.</exception>
|
/// <exception cref="ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> ty is true.</exception>
|
||||||
public void StartListeningForNotifications()
|
public void StartListeningForNotifications()
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
|
||||||
|
|
||||||
_CommunicationsServer.RequestReceived -= CommsServer_RequestReceived;
|
_CommunicationsServer.RequestReceived -= CommsServer_RequestReceived;
|
||||||
_CommunicationsServer.RequestReceived += CommsServer_RequestReceived;
|
_CommunicationsServer.RequestReceived += CommsServer_RequestReceived;
|
||||||
_CommunicationsServer.BeginListeningForBroadcasts();
|
_CommunicationsServer.BeginListeningForBroadcasts();
|
||||||
|
@ -353,7 +356,7 @@ namespace Rssdp.Infrastructure
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var location = GetFirstHeaderUriValue("Location", message);
|
var location = GetFirstHeaderUriValue("Location", message);
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
|
@ -515,11 +518,6 @@ namespace Rssdp.Infrastructure
|
||||||
|
|
||||||
private void RemoveExpiredDevicesFromCache()
|
private void RemoveExpiredDevicesFromCache()
|
||||||
{
|
{
|
||||||
if (this.IsDisposed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DiscoveredSsdpDevice[] expiredDevices = null;
|
DiscoveredSsdpDevice[] expiredDevices = null;
|
||||||
lock (_Devices)
|
lock (_Devices)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue