mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
avoid responding to self messages
This commit is contained in:
parent
4bf8c8211f
commit
fabb4f4c95
@ -333,6 +333,11 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||
var args = SsdpHelper.ParseSsdpResponse(received);
|
||||
args.EndPoint = endpoint;
|
||||
|
||||
if (IsSelfNotification(args))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enableDebugLogging)
|
||||
{
|
||||
var headerTexts = args.Headers.Select(i => string.Format("{0}={1}", i.Key, i.Value));
|
||||
@ -354,6 +359,44 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsSelfNotification(SsdpMessageEventArgs args)
|
||||
{
|
||||
// Avoid responding to self search messages
|
||||
//string serverId;
|
||||
//if (args.Headers.TryGetValue("X-EMBYSERVERID", out serverId) &&
|
||||
// string.Equals(serverId, _appHost.SystemId, StringComparison.OrdinalIgnoreCase))
|
||||
//{
|
||||
// return true;
|
||||
//}
|
||||
|
||||
string server;
|
||||
args.Headers.TryGetValue("SERVER", out server);
|
||||
|
||||
if (string.Equals(server, _serverSignature, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
//string usn;
|
||||
//args.Headers.TryGetValue("USN", out usn);
|
||||
|
||||
//if (string.IsNullOrWhiteSpace(usn))
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//_logger.Debug("IsSelfNotification test: " + usn);
|
||||
|
||||
//return RegisteredDevices.Any(i =>
|
||||
//{
|
||||
// var isSameDevice = string.Equals(usn, i.USN, StringComparison.OrdinalIgnoreCase) ||
|
||||
// i.USN.IndexOf(usn, StringComparison.OrdinalIgnoreCase) != 1 ||
|
||||
// usn.IndexOf(i.USN, StringComparison.OrdinalIgnoreCase) != 1;
|
||||
|
||||
// return isSameDevice;
|
||||
//});
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_config.NamedConfigurationUpdated -= _config_ConfigurationUpdated;
|
||||
|
Loading…
Reference in New Issue
Block a user