update socket methods

This commit is contained in:
Luke Pulverenti
2017-03-26 15:00:35 -04:00
parent 240000f965
commit caaa906604
5 changed files with 107 additions and 197 deletions

View File

@@ -203,19 +203,6 @@ namespace Emby.Server.Implementations.Udp
GC.SuppressFinalize(this);
}
/// <summary>
/// Stops this instance.
/// </summary>
public void Stop()
{
_isDisposed = true;
if (_udpClient != null)
{
_udpClient.Dispose();
}
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
@@ -224,7 +211,12 @@ namespace Emby.Server.Implementations.Udp
{
if (dispose)
{
Stop();
_isDisposed = true;
if (_udpClient != null)
{
_udpClient.Dispose();
}
}
}
@@ -247,9 +239,13 @@ namespace Emby.Server.Implementations.Udp
try
{
await _udpClient.SendAsync(bytes, bytes.Length, remoteEndPoint, CancellationToken.None).ConfigureAwait(false);
await _udpClient.SendWithLockAsync(bytes, bytes.Length, remoteEndPoint, CancellationToken.None).ConfigureAwait(false);
_logger.Info("Udp message sent to {0}", remoteEndPoint);
}
catch (OperationCanceledException)
{
}
catch (Exception ex)
{