update RespondToSearch
This commit is contained in:
parent
f13ca8f343
commit
bfa1b30cab
|
@ -303,9 +303,17 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||
|
||||
var msg = new SsdpMessageBuilder().BuildMessage(header, values);
|
||||
|
||||
var ipEndPoint = endpoint as IPEndPoint;
|
||||
if (ipEndPoint != null)
|
||||
{
|
||||
SendUnicastRequest(msg, ipEndPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendDatagram(msg, endpoint, null, false, 2);
|
||||
SendDatagram(msg, endpoint, new IPEndPoint(d.Address, 0), false, 2);
|
||||
//SendDatagram(header, values, endpoint, null, true);
|
||||
}
|
||||
|
||||
if (enableDebugLogging)
|
||||
{
|
||||
|
@ -588,7 +596,22 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||
}
|
||||
}
|
||||
|
||||
private async void SendUnicastRequest(string request, int sendCount = 3)
|
||||
private void SendUnicastRequest(string request, int sendCount = 3)
|
||||
{
|
||||
if (_unicastClient == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.Debug("Sending unicast search request");
|
||||
|
||||
var ipSsdp = IPAddress.Parse(SSDPAddr);
|
||||
var ipTxEnd = new IPEndPoint(ipSsdp, SSDPPort);
|
||||
|
||||
SendUnicastRequest(request, ipTxEnd, sendCount);
|
||||
}
|
||||
|
||||
private async void SendUnicastRequest(string request, IPEndPoint toEndPoint, int sendCount = 3)
|
||||
{
|
||||
if (_unicastClient == null)
|
||||
{
|
||||
|
@ -598,8 +621,6 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||
_logger.Debug("Sending unicast search request");
|
||||
|
||||
byte[] req = Encoding.ASCII.GetBytes(request);
|
||||
var ipSsdp = IPAddress.Parse(SSDPAddr);
|
||||
var ipTxEnd = new IPEndPoint(ipSsdp, SSDPPort);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -609,7 +630,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||
{
|
||||
await Task.Delay(50).ConfigureAwait(false);
|
||||
}
|
||||
_unicastClient.Send(req, req.Length, ipTxEnd);
|
||||
_unicastClient.Send(req, req.Length, toEndPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Reference in New Issue
Block a user