Updatig netcollection & re-inserting BOM

This commit is contained in:
Jim Cartlidge 2020-10-04 09:56:33 +01:00
parent 3b64171cde
commit 53af1e3455
8 changed files with 21 additions and 20 deletions

View File

@ -271,33 +271,33 @@ namespace Emby.Dlna.Main
bindAddresses = _networkManager.GetLoopbacks();
}
foreach (var addr in bindAddresses)
foreach (IPNetAddress address in bindAddresses)
{
if (addr.AddressFamily == AddressFamily.InterNetworkV6)
if (address.AddressFamily == AddressFamily.InterNetworkV6)
{
// Not supporting IPv6 right now
continue;
}
// Limit to LAN addresses only
if (!_networkManager.IsInLocalNetwork(addr))
if (!_networkManager.IsInLocalNetwork(address))
{
continue;
}
var fullService = "urn:schemas-upnp-org:device:MediaServer:1";
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, addr);
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
var descriptorUri = "/dlna/" + udn + "/description.xml";
var uri = new Uri(_appHost.GetSmartApiUrl(addr.Address) + descriptorUri);
var uri = new Uri(_appHost.GetSmartApiUrl(address.Address) + descriptorUri);
var device = new SsdpRootDevice
{
CacheLifetime = TimeSpan.FromSeconds(1800), // How long SSDP clients can cache this info.
Location = uri, // Must point to the URL that serves your devices UPnP description document.
Address = addr.Address,
SubnetMask = ((IPNetAddress)addr).Mask, // MIGRATION: This fields is going.
Address = address.Address,
SubnetMask = address.Mask,
FriendlyName = "Jellyfin",
Manufacturer = "Jellyfin",
ModelName = "Jellyfin Server",

View File

@ -262,8 +262,8 @@ namespace Emby.Server.Implementations
IServiceCollection serviceCollection)
{
_xmlSerializer = new MyXmlSerializer();
_jsonSerializer = new JsonSerializer();
_jsonSerializer = new JsonSerializer();
ServiceCollection = serviceCollection;
ApplicationPaths = applicationPaths;
@ -1079,7 +1079,7 @@ namespace Emby.Server.Implementations
{
// No metafile, so lets see if the folder is versioned.
metafile = dir.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[^1];
int versionIndex = dir.LastIndexOf('_');
if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version ver))
{
@ -1248,7 +1248,7 @@ namespace Emby.Server.Implementations
OperatingSystem = OperatingSystem.Id.ToString(),
ServerName = FriendlyName,
LocalAddress = GetSmartApiUrl(source),
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
};
}

View File

@ -76,7 +76,6 @@ namespace Emby.Server.Implementations.LiveTv
}
var list = sources.ToList();
var serverUrl = _appHost.GetSmartApiUrl(string.Empty);
foreach (var source in list)
{
@ -103,7 +102,7 @@ namespace Emby.Server.Implementations.LiveTv
// Dummy this up so that direct play checks can still run
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
{
source.Path = serverUrl;
source.Path = _appHost.GetSmartApiUrl(string.Empty);
}
}

View File

@ -16,6 +16,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
using NetworkCollection.Udp;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
@ -57,7 +58,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var mediaSource = OriginalMediaSource;
var uri = new Uri(mediaSource.Path);
var localPort = 50000; // Will return to random after next PR.
var localPort = UdpHelper.GetRandomUnusedUdpPort();
Directory.CreateDirectory(Path.GetDirectoryName(TempFilePath));

View File

@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Udp
{
string localUrl = !string.IsNullOrEmpty(_config[AddressOverrideConfigKey])
? _config[AddressOverrideConfigKey]
: _appHost.GetSmartApiUrl(string.Empty); // MIGRATION: Temp value.
: _appHost.GetSmartApiUrl(((IPEndPoint)endpoint).Address);
if (!string.IsNullOrEmpty(localUrl))
{

View File

@ -28,7 +28,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="3.1.7" />
<PackageReference Include="NetworkCollection" Version="1.0.3" />
<PackageReference Include="NetworkCollection" Version="1.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -352,7 +352,7 @@ namespace Rssdp.Infrastructure
if (_enableMultiSocketBinding)
{
foreach (var address in _networkManager.GetAllBindInterfaces())
foreach (var address in _networkManager.GetInternalBindAddresses())
{
if (address.AddressFamily == AddressFamily.InterNetworkV6)
{

View File

@ -301,9 +301,10 @@ namespace Rssdp.Infrastructure
foreach (var device in deviceList)
{
var ip1 = new IPNetAddress(device.ToRootDevice().Address, device.ToRootDevice().SubnetMask);
var ip2 = new IPNetAddress(remoteEndPoint.Address, device.ToRootDevice().SubnetMask);
if (!_sendOnlyMatchedHost || ip1.NetworkAddress.Equals(ip2.NetworkAddress))
var root = device.ToRootDevice();
var source = new IPNetAddress(root.Address, root.SubnetMask);
var destination = new IPNetAddress(remoteEndPoint.Address, root.SubnetMask);
if (!_sendOnlyMatchedHost || source.NetworkAddress.Equals(destination.NetworkAddress))
{
SendDeviceSearchResponses(device, remoteEndPoint, receivedOnlocalIpAddress, cancellationToken);
}