aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2020-07-15 08:16:21 +0900
committerGitHub <noreply@github.com>2020-07-15 08:16:21 +0900
commit2307052efcb8ada177d0007384a4e17fcc2ac513 (patch)
treeec92707cf26fa18e91e8b654b7dd125ab00918db
parent175e7b45e56fb97b0f9bdddd99c195af3ecabcc6 (diff)
parentda8eb1f15b034b946e6533baffca8ffa17bcb3a7 (diff)
Merge pull request #3549 from neilsb/master
Prevent failure to bind to Auto Discover port being a fatal error
-rw-r--r--Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
index b207397bd..9486874d5 100644
--- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
@@ -1,3 +1,4 @@
+using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Udp;
@@ -48,8 +49,16 @@ namespace Emby.Server.Implementations.EntryPoints
/// <inheritdoc />
public Task RunAsync()
{
- _udpServer = new UdpServer(_logger, _appHost, _config);
- _udpServer.Start(PortNumber, _cancellationTokenSource.Token);
+ try
+ {
+ _udpServer = new UdpServer(_logger, _appHost, _config);
+ _udpServer.Start(PortNumber, _cancellationTokenSource.Token);
+ }
+ catch (SocketException ex)
+ {
+ _logger.LogWarning(ex, "Unable to start AutoDiscovery listener on UDP port {PortNumber}", PortNumber);
+ }
+
return Task.CompletedTask;
}