From e8ca3805b3cc345e36830c6ec8b7f05394bbc721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 19 Feb 2023 08:40:56 +0100 Subject: [PATCH] feat(pcap): do not lock semaphore for too long while getting tcp connections --- Pcap/NosSmooth.Pcap/ProcessTcpManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Pcap/NosSmooth.Pcap/ProcessTcpManager.cs b/Pcap/NosSmooth.Pcap/ProcessTcpManager.cs index 9d12965..945404b 100644 --- a/Pcap/NosSmooth.Pcap/ProcessTcpManager.cs +++ b/Pcap/NosSmooth.Pcap/ProcessTcpManager.cs @@ -109,8 +109,9 @@ public class ProcessTcpManager } } - await _semaphore.WaitAsync(); - _connections = TcpConnectionHelper.GetConnections(_processes); + _semaphore.WaitAsync(); + var processes = new List(_processes); _semaphore.Release(); + _connections = TcpConnectionHelper.GetConnections(processes); } } \ No newline at end of file -- 2.48.1