Skip to content

Commit

Permalink
throw pending exception from channel
Browse files Browse the repository at this point in the history
  • Loading branch information
awcullen committed Dec 10, 2023
1 parent 6595ddc commit af53521
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions UaClient/ServiceModel/Ua/Channels/ClientSecureChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,7 @@ public virtual async Task<IServiceResponse> RequestAsync(IServiceRequest request
// TimestampHeader takes care that the RequestHeader property will not be null
using (var timeoutCts = new CancellationTokenSource((int)request.RequestHeader!.TimeoutHint))
using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, _channelCts.Token, token))
using (var registration = linkedCts.Token.Register(o =>
{
var statusCode = StatusCodes.BadRequestTimeout;
if (PeakFirstPendingException() is ServiceResultException result)
statusCode = result.StatusCode;
((ServiceOperation)o!).TrySetException(new ServiceResultException(statusCode));
}, operation, false))
using (var registration = linkedCts.Token.Register(o => ((ServiceOperation)o!).TrySetException(GetPendingException() ?? new ServiceResultException(StatusCodes.BadRequestTimeout)), operation, false))
{
if (_pendingRequests.Post(operation))
{
Expand Down

0 comments on commit af53521

Please sign in to comment.