Skip to content

Commit

Permalink
Code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kees committed May 22, 2024
1 parent cfac3cb commit 0008de2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ChromiumHtmlToPdfLib/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private static async Task ReceiveLoop(object? stateData)
{
// Ignore
}
catch (WebSocketException wsex) when (wsex.Message == "The remote party closed the WebSocket connection without completing the close handshake.")
catch (WebSocketException webSocketException) when (webSocketException.Message == "The remote party closed the WebSocket connection without completing the close handshake.")
{
// Ignore
}
Expand Down Expand Up @@ -265,8 +265,8 @@ internal async Task<string> SendForResponseAsync(Message message, CancellationTo

await _webSocket.SendAsync(MessageToBytes(message), WebSocketMessageType.Text, true, cancellationToken).ConfigureAwait(false);

var response = tcs.Task.Result;
return response;
tcs.Task.Wait(cancellationToken);
return cancellationToken.IsCancellationRequested ? tcs.Task.Result : string.Empty;
}
catch (Exception exception)
{
Expand Down

0 comments on commit 0008de2

Please sign in to comment.