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
1 changed files with 4 additions and 0 deletions

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;
}