From 1f8459e3ab3fc369fd87029e2d1b611250b61428 Mon Sep 17 00:00:00 2001 From: David Kallesen Date: Wed, 14 Feb 2024 23:14:59 +0100 Subject: [PATCH] fix: Move the syncLock.Dispose to the right place --- src/Atc.Network/Tcp/TcpClient.cs | 4 ++-- src/Atc.Network/Udp/UdpClient.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Atc.Network/Tcp/TcpClient.cs b/src/Atc.Network/Tcp/TcpClient.cs index 1079658..5345e51 100644 --- a/src/Atc.Network/Tcp/TcpClient.cs +++ b/src/Atc.Network/Tcp/TcpClient.cs @@ -360,6 +360,8 @@ protected virtual void Dispose( DisposeCancellationTokenAndTask(); DisposeTcpClientAndStream(); + + syncLock.Dispose(); } private void InvokeConnected() @@ -822,8 +824,6 @@ private void DisposeTcpClientAndStream() tcpClient.Dispose(); tcpClient = null; } - - syncLock.Dispose(); } private void CancellationTokenCallback() diff --git a/src/Atc.Network/Udp/UdpClient.cs b/src/Atc.Network/Udp/UdpClient.cs index 3083481..6e95b40 100644 --- a/src/Atc.Network/Udp/UdpClient.cs +++ b/src/Atc.Network/Udp/UdpClient.cs @@ -256,6 +256,8 @@ protected virtual void Dispose( DisposeCancellationTokenAndTask(); DisposeSocket(); + + syncLock.Dispose(); } private void InvokeConnected() @@ -548,7 +550,5 @@ private void DisposeSocket() socket.Dispose(); socket = null; } - - syncLock.Dispose(); } } \ No newline at end of file