Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ private enum ParsingState : byte
Done
}

public override bool NeedsDrain => (_connection != null);
// _connection == null typically means that we have finished reading the response.
// Cancellation may lead to a state where a disposed _connection is not null.
public override bool NeedsDrain => _connection != null && _connection._disposed != Status_Disposed;

public override async ValueTask<bool> DrainAsync(int maxDrainBytes)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ private ReadOnlyMemory<byte> ReadFromConnectionBuffer(int maxBytesToRead)
return connectionBuffer.Slice(0, bytesToConsume);
}

public override bool NeedsDrain => (_connection != null);
// _connection == null typically means that we have finished reading the response.
// Cancellation may lead to a state where a disposed _connection is not null.
public override bool NeedsDrain => _connection != null && _connection._disposed != Status_Disposed;

public override async ValueTask<bool> DrainAsync(int maxDrainBytes)
{
Expand Down