Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Apply suggestions from code review
  • Loading branch information
halter73 authored Nov 2, 2023
commit 2cd9ae0e90de9cd4dc6b054a03adc48d8bc69480
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,24 @@ public PipeOptions(
{
pauseWriterThreshold = DefaultPauseWriterThreshold;
}
else if (pauseWriterThreshold < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.pauseWriterThreshold);
}

if (resumeWriterThreshold == -1)
{
resumeWriterThreshold = DefaultResumeWriterThreshold;
}

if (pauseWriterThreshold < 0)
else if (resumeWriterThreshold == 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.pauseWriterThreshold);
// A resumeWriterThreshold of 0 makes no sense because the writer could never resume if paused.
// By setting it to 1, the writer will resume only after all data is consumed.
resumeWriterThreshold = 1;
}
else if (resumeWriterThreshold < 0 || resumeWriterThreshold > pauseWriterThreshold)

// Only validate that the resumeWriterThreshold is not too large if the writer could actually pause.
if (resumeWriterThreshold < 0 || (pauseWriterThreshold > 0 && resumeWriterThreshold > pauseWriterThreshold))
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.resumeWriterThreshold);
}
Expand Down