feat: 部分修复摄像头批量读逻辑

This commit is contained in:
alivender
2025-07-14 12:14:40 +08:00
parent 9b580be5e9
commit c5f0e706a4
2 changed files with 13 additions and 10 deletions

View File

@@ -367,15 +367,17 @@ public class UDPServer
return retPack.Value;
}
static int ReceiveHandleCcount = 0;
private void ReceiveHandler(IAsyncResult res)
{
logger.Trace("Enter handler");
var remoteEP = new IPEndPoint(IPAddress.Any, listenPort);
byte[] bytes = listener.EndReceive(res, ref remoteEP);
// 提前开始接收下一个包
listener.BeginReceive(new AsyncCallback(ReceiveHandler), null);
logger.Debug($"Test ReceiveHandler Count = {ReceiveHandleCcount}");
ReceiveHandleCcount++;
// Handle RemoteEP
if (remoteEP is null)
@@ -431,7 +433,7 @@ public class UDPServer
udpData.TryGetValue($"{remoteAddress}-{taskID}", out var dataQueue))
{
dataQueue.Enqueue(data);
logger.Trace("Receive data from old client");
logger.Debug($"Test Lock dataQueue.Count = {dataQueue.Count}");
}
else
{