less locking for screen connection, force more concurrency

This commit is contained in:
Vinzenz Schroeter 2024-04-30 23:49:39 +02:00 committed by RobbersDaughter
parent 0b10695e07
commit 0e93b1356f
10 changed files with 143 additions and 93 deletions

View file

@ -16,20 +16,20 @@ internal sealed class ByteChannelWebSocket(WebSocket socket, ILogger logger, int
catch (WebSocketException e)
{
logger.LogError(e, "could not send binary message");
await CloseAsync();
await CloseWithErrorAsync(e.Message);
}
}
public async ValueTask SendTextAsync(ReadOnlyMemory<byte> data, bool endOfMessage = true)
public async ValueTask SendTextAsync(ReadOnlyMemory<byte> utf8Data, bool endOfMessage = true)
{
try
{
await socket.SendAsync(data, WebSocketMessageType.Text, endOfMessage, CancellationToken.None);
await socket.SendAsync(utf8Data, WebSocketMessageType.Text, endOfMessage, CancellationToken.None);
}
catch (WebSocketException e)
{
logger.LogError(e, "could not send text message");
await CloseAsync();
await CloseWithErrorAsync(e.Message);
}
}