The Free Software Media System - Server Backend & API
Fix: PlayTo using external ip not internal
BaronGreenback3199d1c902f6
diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.csindex a6793a7081..e9cab17f0d 100644--- a/Emby.Dlna/PlayTo/PlayToManager.cs+++ b/Emby.Dlna/PlayTo/PlayToManager.cs@@ -183,7 +183,7 @@ namespace Emby.Dlna.PlayTo_sessionManager.UpdateDeviceName(sessionInfo.Id, deviceName);- string serverAddress = _appHost.GetSmartApiUrl(info.LocalIpAddress);+ string serverAddress = _appHost.GetSmartApiUrl(info.RemoteIpAddress);controller = new PlayToController(sessionInfo,diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.csindex 8c7d961f3e..70223cbdbc 100644--- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs+++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs@@ -104,7 +104,7 @@ namespace Emby.Dlna.Ssdp{Location = e.DiscoveredDevice.DescriptionLocation,Headers = headers,- LocalIpAddress = e.LocalIpAddress+ RemoteIpAddress = e.RemoteIpAddress});DeviceDiscoveredInternal?.Invoke(this, args);diff --git a/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs b/MediaBrowser.Model/Dlna/UpnpDeviceInfo.csindex d71013f019..987a3a908f 100644--- a/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs+++ b/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs@@ -16,5 +16,7 @@ namespace MediaBrowser.Model.Dlnapublic IPAddress LocalIpAddress { get; set; }public int LocalPort { get; set; }++ public IPAddress RemoteIpAddress { get; set; }}}diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.csindex b7d22a7df5..04b14c4dca 100644--- a/RSSDP/DeviceAvailableEventArgs.cs+++ b/RSSDP/DeviceAvailableEventArgs.cs@@ -8,7 +8,7 @@ namespace Rssdp/// </summary>public sealed class DeviceAvailableEventArgs : EventArgs{- public IPAddress LocalIpAddress { get; set; }+ public IPAddress RemoteIpAddress { get; set; }private readonly DiscoveredSsdpDevice _DiscoveredDevice;diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.csindex bfad6de97a..eb99788f08 100644--- a/RSSDP/SsdpDeviceLocator.cs+++ b/RSSDP/SsdpDeviceLocator.cs@@ -208,7 +208,7 @@ namespace Rssdp.Infrastructure/// Raises the <see cref="DeviceAvailable"/> event./// </summary>/// <seealso cref="DeviceAvailable"/>- protected virtual void OnDeviceAvailable(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress localIpAddress)+ protected virtual void OnDeviceAvailable(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress IpAddress){if (this.IsDisposed){@@ -220,7 +220,7 @@ namespace Rssdp.Infrastructure{handlers(this, new DeviceAvailableEventArgs(device, isNewDevice){- LocalIpAddress = localIpAddress+ RemoteIpAddress = IpAddress});}}@@ -286,7 +286,7 @@ namespace Rssdp.Infrastructure}}- private void AddOrUpdateDiscoveredDevice(DiscoveredSsdpDevice device, IPAddress localIpAddress)+ private void AddOrUpdateDiscoveredDevice(DiscoveredSsdpDevice device, IPAddress IpAddress){bool isNewDevice = false;lock (_Devices)@@ -304,17 +304,17 @@ namespace Rssdp.Infrastructure}}- DeviceFound(device, isNewDevice, localIpAddress);+ DeviceFound(device, isNewDevice, IpAddress);}- private void DeviceFound(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress localIpAddress)+ private void DeviceFound(DiscoveredSsdpDevice device, bool isNewDevice, IPAddress IpAddress){if (!NotificationTypeMatchesFilter(device)){return;}- OnDeviceAvailable(device, isNewDevice, localIpAddress);+ OnDeviceAvailable(device, isNewDevice, IpAddress);}private bool NotificationTypeMatchesFilter(DiscoveredSsdpDevice device)@@ -347,7 +347,7 @@ namespace Rssdp.Infrastructurereturn _CommunicationsServer.SendMulticastMessage(message, null, cancellationToken);}- private void ProcessSearchResponseMessage(HttpResponseMessage message, IPAddress localIpAddress)+ private void ProcessSearchResponseMessage(HttpResponseMessage message, IPAddress IpAddress){if (!message.IsSuccessStatusCode){@@ -367,11 +367,11 @@ namespace Rssdp.InfrastructureResponseHeaders = message.Headers};- AddOrUpdateDiscoveredDevice(device, localIpAddress);+ AddOrUpdateDiscoveredDevice(device, IpAddress);}}- private void ProcessNotificationMessage(HttpRequestMessage message, IPAddress localIpAddress)+ private void ProcessNotificationMessage(HttpRequestMessage message, IPAddress IpAddress){if (String.Compare(message.Method.Method, "Notify", StringComparison.OrdinalIgnoreCase) != 0){@@ -381,7 +381,7 @@ namespace Rssdp.Infrastructurevar notificationType = GetFirstHeaderStringValue("NTS", message);if (String.Compare(notificationType, SsdpConstants.SsdpKeepAliveNotification, StringComparison.OrdinalIgnoreCase) == 0){- ProcessAliveNotification(message, localIpAddress);+ ProcessAliveNotification(message, IpAddress);}else if (String.Compare(notificationType, SsdpConstants.SsdpByeByeNotification, StringComparison.OrdinalIgnoreCase) == 0){@@ -389,7 +389,7 @@ namespace Rssdp.Infrastructure}}- private void ProcessAliveNotification(HttpRequestMessage message, IPAddress localIpAddress)+ private void ProcessAliveNotification(HttpRequestMessage message, IPAddress IpAddress){var location = GetFirstHeaderUriValue("Location", message);if (location != null)@@ -404,7 +404,7 @@ namespace Rssdp.InfrastructureResponseHeaders = message.Headers};- AddOrUpdateDiscoveredDevice(device, localIpAddress);+ AddOrUpdateDiscoveredDevice(device, IpAddress);}}@@ -630,7 +630,7 @@ namespace Rssdp.Infrastructureprivate void CommsServer_RequestReceived(object sender, RequestReceivedEventArgs e){- ProcessNotificationMessage(e.Message, e.LocalIpAddress);+ ProcessNotificationMessage(e.Message, e.ReceivedFrom.Address);}}}