update OnMessageReceived

This commit is contained in:
Luke Pulverenti 2015-05-04 13:53:45 -04:00
parent cc160367c8
commit 4bf8c8211f

View File

@ -88,24 +88,21 @@ namespace MediaBrowser.Dlna.Ssdp
private async void OnMessageReceived(SsdpMessageEventArgs args) private async void OnMessageReceived(SsdpMessageEventArgs args)
{ {
if (string.Equals(args.Method, "M-SEARCH", StringComparison.OrdinalIgnoreCase)) var headers = args.Headers;
{ string st;
var headers = args.Headers;
if (string.Equals(args.Method, "M-SEARCH", StringComparison.OrdinalIgnoreCase) && headers.TryGetValue("st", out st))
{
TimeSpan delay = GetSearchDelay(headers); TimeSpan delay = GetSearchDelay(headers);
if (_config.GetDlnaConfiguration().EnableDebugLogging) if (_config.GetDlnaConfiguration().EnableDebugLogging)
{ {
_logger.Debug("Delaying search response by {0} seconds", delay.TotalSeconds); _logger.Debug("Delaying search response by {0} seconds", delay.TotalSeconds);
} }
await Task.Delay(delay).ConfigureAwait(false); await Task.Delay(delay).ConfigureAwait(false);
string st; RespondToSearch(args.EndPoint, st);
if (headers.TryGetValue("st", out st))
{
RespondToSearch(args.EndPoint, st);
}
} }
EventHelper.FireEventIfNotNull(MessageReceived, this, args, _logger); EventHelper.FireEventIfNotNull(MessageReceived, this, args, _logger);