mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update RespondToSearch
This commit is contained in:
parent
f13ca8f343
commit
bfa1b30cab
@ -144,7 +144,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
//var protocol = isMulticast ? "Multicast" : "Unicast";
|
//var protocol = isMulticast ? "Multicast" : "Unicast";
|
||||||
//var localEndPointString = args.LocalEndPoint == null ? "null" : args.LocalEndPoint.ToString();
|
//var localEndPointString = args.LocalEndPoint == null ? "null" : args.LocalEndPoint.ToString();
|
||||||
//_logger.Debug("IGNORING {0} message received from {1} on {3}. Protocol: {4} Headers: {2}", args.Method, args.EndPoint, headerText, localEndPointString, protocol);
|
//_logger.Debug("IGNORING {0} message received from {1} on {3}. Protocol: {4} Headers: {2}", args.Method, args.EndPoint, headerText, localEndPointString, protocol);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,9 +303,17 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
|
|
||||||
var msg = new SsdpMessageBuilder().BuildMessage(header, values);
|
var msg = new SsdpMessageBuilder().BuildMessage(header, values);
|
||||||
|
|
||||||
SendDatagram(msg, endpoint, null, false, 2);
|
var ipEndPoint = endpoint as IPEndPoint;
|
||||||
SendDatagram(msg, endpoint, new IPEndPoint(d.Address, 0), false, 2);
|
if (ipEndPoint != null)
|
||||||
//SendDatagram(header, values, endpoint, null, true);
|
{
|
||||||
|
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)
|
if (enableDebugLogging)
|
||||||
{
|
{
|
||||||
@ -583,12 +591,27 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (_unicastClient == null)
|
||||||
{
|
{
|
||||||
@ -598,8 +621,6 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
_logger.Debug("Sending unicast search request");
|
_logger.Debug("Sending unicast search request");
|
||||||
|
|
||||||
byte[] req = Encoding.ASCII.GetBytes(request);
|
byte[] req = Encoding.ASCII.GetBytes(request);
|
||||||
var ipSsdp = IPAddress.Parse(SSDPAddr);
|
|
||||||
var ipTxEnd = new IPEndPoint(ipSsdp, SSDPPort);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -609,7 +630,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
|||||||
{
|
{
|
||||||
await Task.Delay(50).ConfigureAwait(false);
|
await Task.Delay(50).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
_unicastClient.Send(req, req.Length, ipTxEnd);
|
_unicastClient.Send(req, req.Length, toEndPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user