Fix AutoDiscovery socket creation

This commit is contained in:
Shadowghost 2023-02-23 13:55:27 +01:00
parent a5bfeb28aa
commit 7af6694594

View File

@ -82,7 +82,9 @@ namespace Emby.Server.Implementations.EntryPoints
if (_enableMultiSocketBinding) if (_enableMultiSocketBinding)
{ {
// Add global broadcast socket // Add global broadcast socket
_udpServers.Add(new UdpServer(_logger, _appHost, _config, IPAddress.Broadcast, PortNumber)); var server = new UdpServer(_logger, _appHost, _config, IPAddress.Broadcast, PortNumber);
server.Start(_cancellationTokenSource.Token);
_udpServers.Add(server);
// Add bind address specific broadcast sockets // Add bind address specific broadcast sockets
// IPv6 is currently unsupported // IPv6 is currently unsupported
@ -90,9 +92,9 @@ namespace Emby.Server.Implementations.EntryPoints
foreach (var intf in validInterfaces) foreach (var intf in validInterfaces)
{ {
var broadcastAddress = NetworkExtensions.GetBroadcastAddress(intf.Subnet); var broadcastAddress = NetworkExtensions.GetBroadcastAddress(intf.Subnet);
_logger.LogDebug("Binding UDP server to {Address} on port {PortNumber}", broadcastAddress.ToString(), PortNumber); _logger.LogDebug("Binding UDP server to {Address} on port {PortNumber}", broadcastAddress, PortNumber);
var server = new UdpServer(_logger, _appHost, _config, broadcastAddress, PortNumber); server = new UdpServer(_logger, _appHost, _config, broadcastAddress, PortNumber);
server.Start(_cancellationTokenSource.Token); server.Start(_cancellationTokenSource.Token);
_udpServers.Add(server); _udpServers.Add(server);
} }