mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Catch exceptions in auto discovery (#11252)
This commit is contained in:
parent
000395e036
commit
ed82d79647
@ -77,6 +77,8 @@ public sealed class AutoDiscoveryHost : BackgroundService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task ListenForAutoDiscoveryMessage(IPAddress address, CancellationToken cancellationToken)
|
private async Task ListenForAutoDiscoveryMessage(IPAddress address, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using var udpClient = new UdpClient(new IPEndPoint(address, PortNumber));
|
using var udpClient = new UdpClient(new IPEndPoint(address, PortNumber));
|
||||||
udpClient.MulticastLoopback = false;
|
udpClient.MulticastLoopback = false;
|
||||||
@ -96,10 +98,16 @@ public sealed class AutoDiscoveryHost : BackgroundService
|
|||||||
{
|
{
|
||||||
_logger.LogError(ex, "Failed to receive data from socket");
|
_logger.LogError(ex, "Failed to receive data from socket");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Broadcast socket operation cancelled");
|
_logger.LogDebug("Broadcast socket operation cancelled");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Exception in this function will prevent the background service from restarting in-process.
|
||||||
|
_logger.LogError(ex, "Unable to bind to {Address}:{Port}", address, PortNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user