|
|
@ -101,11 +101,18 @@ namespace Emby.Server.Implementations.Udp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while (!cancellationToken.IsCancellationRequested)
|
|
|
|
while (!cancellationToken.IsCancellationRequested)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var infiniteTask = Task.Delay(-1, cancellationToken);
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var result = await _udpSocket.ReceiveFromAsync(_receiveBuffer, SocketFlags.None, _endpoint).ConfigureAwait(false);
|
|
|
|
var task = _udpSocket.ReceiveFromAsync(_receiveBuffer, SocketFlags.None, _endpoint);
|
|
|
|
|
|
|
|
await Task.WhenAny(task, infiniteTask).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
if (!task.IsCompleted)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = task.Result;
|
|
|
|
|
|
|
|
|
|
|
|
var text = Encoding.UTF8.GetString(_receiveBuffer, 0, result.ReceivedBytes);
|
|
|
|
var text = Encoding.UTF8.GetString(_receiveBuffer, 0, result.ReceivedBytes);
|
|
|
|
if (text.Contains("who is JellyfinServer?", StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (text.Contains("who is JellyfinServer?", StringComparison.OrdinalIgnoreCase))
|
|
|
|