diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-03-26 15:06:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-26 15:06:02 -0400 |
| commit | a937ecfe821c5bf090c5a58638ea6f4d80230ada (patch) | |
| tree | cfb186b6718796269e8c611bfbf6db12d2a2d7cf /Emby.Server.Implementations | |
| parent | 5063c2c3101364b4f1c3f6a245e2a49935aa7c2b (diff) | |
| parent | 07c43a1cd3979e67ac3547f3a76a7daab5cd4bc7 (diff) | |
Merge pull request #2547 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Udp/UdpServer.cs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/Udp/UdpServer.cs b/Emby.Server.Implementations/Udp/UdpServer.cs index bb303d8fa..21ef3cab6 100644 --- a/Emby.Server.Implementations/Udp/UdpServer.cs +++ b/Emby.Server.Implementations/Udp/UdpServer.cs @@ -204,19 +204,6 @@ namespace Emby.Server.Implementations.Udp } /// <summary> - /// Stops this instance. - /// </summary> - public void Stop() - { - _isDisposed = true; - - if (_udpClient != null) - { - _udpClient.Dispose(); - } - } - - /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> @@ -224,7 +211,12 @@ namespace Emby.Server.Implementations.Udp { if (dispose) { - Stop(); + _isDisposed = true; + + if (_udpClient != null) + { + _udpClient.Dispose(); + } } } @@ -247,10 +239,14 @@ 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) { _logger.ErrorException("Error sending message to {0}", ex, remoteEndPoint); |
