mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 20:08:59 +02:00
update socket methods
This commit is contained in:
parent
85f4f8dbc9
commit
5477bb95d9
1 changed files with 12 additions and 7 deletions
|
@ -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,11 +128,18 @@ namespace Emby.Common.Implementations.Net
|
||||||
_receiveSocketAsyncEventArgs.RemoteEndPoint = receivedFromEndPoint;
|
_receiveSocketAsyncEventArgs.RemoteEndPoint = receivedFromEndPoint;
|
||||||
_currentReceiveTaskCompletionSource = tcs;
|
_currentReceiveTaskCompletionSource = tcs;
|
||||||
|
|
||||||
var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
|
try
|
||||||
|
|
||||||
if (!willRaiseEvent)
|
|
||||||
{
|
{
|
||||||
_receiveSocketAsyncEventArgs_Completed(this, _receiveSocketAsyncEventArgs);
|
var willRaiseEvent = _Socket.ReceiveFromAsync(_receiveSocketAsyncEventArgs);
|
||||||
|
|
||||||
|
if (!willRaiseEvent)
|
||||||
|
{
|
||||||
|
_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…
Reference in a new issue