Skip to content

Commit

Permalink
Merge pull request #35 from atc-net/hotfix/Fix-syncLock-dispose
Browse files Browse the repository at this point in the history
fix: Move the syncLock.Dispose to the right place
  • Loading branch information
davidkallesen authored Feb 14, 2024
2 parents a85f89b + 1f8459e commit 4fc749d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Atc.Network/Tcp/TcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ protected virtual void Dispose(

DisposeCancellationTokenAndTask();
DisposeTcpClientAndStream();

syncLock.Dispose();
}

private void InvokeConnected()
Expand Down Expand Up @@ -822,8 +824,6 @@ private void DisposeTcpClientAndStream()
tcpClient.Dispose();
tcpClient = null;
}

syncLock.Dispose();
}

private void CancellationTokenCallback()
Expand Down
4 changes: 2 additions & 2 deletions src/Atc.Network/Udp/UdpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ protected virtual void Dispose(

DisposeCancellationTokenAndTask();
DisposeSocket();

syncLock.Dispose();
}

private void InvokeConnected()
Expand Down Expand Up @@ -548,7 +550,5 @@ private void DisposeSocket()
socket.Dispose();
socket = null;
}

syncLock.Dispose();
}
}

0 comments on commit 4fc749d

Please sign in to comment.