1
0
mirror of https://github.com/oliverbooth/TcpDotNet synced 2024-11-23 00:28:48 +00:00

fix: set tcs result on callback response

This commit is contained in:
Oliver Booth 2024-02-14 15:23:19 +00:00
parent 50a73d21eb
commit de672241f7
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -16,6 +16,7 @@ public abstract class ClientNode : Node
{
private readonly ConcurrentDictionary<int, List<TaskCompletionSource<Packet>>> _packetCompletionSources = new();
private readonly ConcurrentDictionary<long, TaskCompletionSource<ResponsePacket>> _callbackCompletionSources = new();
private EndPoint? _remoteEP;
/// <summary>
@ -160,6 +161,9 @@ public abstract class ClientNode : Node
}
}
if (packet is ResponsePacket response && _callbackCompletionSources.TryGetValue(response.CallbackId, out TaskCompletionSource<ResponsePacket>? callback))
callback.SetResult(response);
return packet;
}