Skip to content

Commit

Permalink
Fail WebSocket early.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcweber committed Mar 21, 2024
1 parent 36468fa commit 31f8fe2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Providers.Core/Factory/WebSocketGremlinqClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ public IAsyncEnumerable<ResponseMessage<T>> SubmitAsync<T>(RequestMessage messag

static async IAsyncEnumerable<ResponseMessage<T>> Core(RequestMessage message, WebSocketGremlinqClient @this, [EnumeratorCancellation] CancellationToken ct = default)
{
if (@this._client.CloseStatus is not null)
throw new ObjectDisposedException(nameof(WebSocketGremlinqClient));

Check warning on line 231 in src/Providers.Core/Factory/WebSocketGremlinqClientFactory.cs

View check run for this annotation

Codecov / codecov/patch

src/Providers.Core/Factory/WebSocketGremlinqClientFactory.cs#L231

Added line #L231 was not covered by tests

using (var channel = new Channel<T>(@this))
{
using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(ct, @this._cts.Token))
Expand Down Expand Up @@ -307,9 +310,9 @@ private async Task SendCore(RequestMessage requestMessage, CancellationToken ct)
{
using (buffer)
{
await _client.SendAsync(buffer.Memory, WebSocketMessageType.Binary, true, ct);
}
}
await _client.SendAsync(buffer.Memory, WebSocketMessageType.Binary, true, ct);
}
}
else
throw new InvalidOperationException();
}
Expand Down

0 comments on commit 31f8fe2

Please sign in to comment.