Skip to content

Commit

Permalink
Merge pull request #302 from VelvetThePanda/feat/socket-optimizations
Browse files Browse the repository at this point in the history
Fix buffer issue from #300
  • Loading branch information
Nihlus authored Apr 20, 2023
2 parents a337681 + b89ba38 commit 9eac98d
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,11 @@ public async Task<Result<IPayload>> ReceivePayloadAsync(CancellationToken ct = d

using var bufferWriter = new ArrayPoolBufferWriter<byte>(); // Backed by the ArrayPool; the only allocation is the class itself

var buffer = bufferWriter.GetMemory(4096);

ValueWebSocketReceiveResult result;

do
{
var buffer = bufferWriter.GetMemory(4096);
result = await _clientWebSocket.ReceiveAsync(buffer, ct);

if (_clientWebSocket.CloseStatus.HasValue)
Expand Down

0 comments on commit 9eac98d

Please sign in to comment.