mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Check if OS is capable of binding multiple sockets before creating autodiscovery sockets
This commit is contained in:
parent
b01d169d28
commit
a2857c5a02
@ -31,6 +31,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
private readonly IConfiguration _config;
|
private readonly IConfiguration _config;
|
||||||
private readonly IConfigurationManager _configurationManager;
|
private readonly IConfigurationManager _configurationManager;
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
|
private readonly bool _enableMultiSocketBinding;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UDP server.
|
/// The UDP server.
|
||||||
@ -59,6 +60,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
_config = configuration;
|
_config = configuration;
|
||||||
_configurationManager = configurationManager;
|
_configurationManager = configurationManager;
|
||||||
_networkManager = networkManager;
|
_networkManager = networkManager;
|
||||||
|
_enableMultiSocketBinding = OperatingSystem.IsWindows() || OperatingSystem.IsLinux();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -73,15 +75,23 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var bindAddress in _networkManager.GetInternalBindAddresses())
|
if (_enableMultiSocketBinding)
|
||||||
{
|
{
|
||||||
if (bindAddress.AddressFamily == AddressFamily.InterNetworkV6)
|
foreach (var bindAddress in _networkManager.GetInternalBindAddresses())
|
||||||
{
|
{
|
||||||
// Not supporting IPv6 right now
|
if (bindAddress.AddressFamily == AddressFamily.InterNetworkV6)
|
||||||
continue;
|
{
|
||||||
}
|
// Not supporting IPv6 right now
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_udpServer = new UdpServer(_logger, _appHost, _config, bindAddress.Address, PortNumber);
|
_udpServer = new UdpServer(_logger, _appHost, _config, bindAddress.Address, PortNumber);
|
||||||
|
_udpServer.Start(_cancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_udpServer = new UdpServer(_logger, _appHost, _config, System.Net.IPAddress.Any, PortNumber);
|
||||||
_udpServer.Start(_cancellationTokenSource.Token);
|
_udpServer.Start(_cancellationTokenSource.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user