mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update socket methods
This commit is contained in:
parent
85f4f8dbc9
commit
5477bb95d9
@ -49,7 +49,7 @@ namespace Emby.Common.Implementations.Net
|
|||||||
|
|
||||||
private void InitReceiveSocketAsyncEventArgs()
|
private void InitReceiveSocketAsyncEventArgs()
|
||||||
{
|
{
|
||||||
var receiveBuffer = new byte[8192];
|
var receiveBuffer = new byte[81920];
|
||||||
_receiveSocketAsyncEventArgs.SetBuffer(receiveBuffer, 0, receiveBuffer.Length);
|
_receiveSocketAsyncEventArgs.SetBuffer(receiveBuffer, 0, receiveBuffer.Length);
|
||||||
_receiveSocketAsyncEventArgs.Completed += _receiveSocketAsyncEventArgs_Completed;
|
_receiveSocketAsyncEventArgs.Completed += _receiveSocketAsyncEventArgs_Completed;
|
||||||
|
|
||||||
@ -128,12 +128,19 @@ namespace Emby.Common.Implementations.Net
|
|||||||
_receiveSocketAsyncEventArgs.RemoteEndPoint = receivedFromEndPoint;
|
_receiveSocketAsyncEventArgs.RemoteEndPoint = receivedFromEndPoint;
|
||||||
_currentReceiveTaskCompletionSource = tcs;
|
_currentReceiveTaskCompletionSource = tcs;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
|
var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
|
||||||
|
|
||||||
if (!willRaiseEvent)
|
if (!willRaiseEvent)
|
||||||
{
|
{
|
||||||
_receiveSocketAsyncEventArgs_Completed(this, _receiveSocketAsyncEventArgs);
|
_receiveSocketAsyncEventArgs_Completed(this, _receiveSocketAsyncEventArgs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
tcs.TrySetException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
@ -189,8 +196,6 @@ namespace Emby.Common.Implementations.Net
|
|||||||
taskSource.TrySetException(ex);
|
taskSource.TrySetException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//_Socket.SendTo(messageData, new System.Net.IPEndPoint(IPAddress.Parse(RemoteEndPoint.IPAddress), RemoteEndPoint.Port));
|
|
||||||
|
|
||||||
return taskSource.Task;
|
return taskSource.Task;
|
||||||
#endif
|
#endif
|
||||||
//ThrowIfDisposed();
|
//ThrowIfDisposed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user