[+] AuIO::IOPipeRequest::bReadEntireAllocation

[*] Fix 24. Hello IO regression
This commit is contained in:
Reece Wilson 2024-09-17 18:23:49 +01:00
parent a4d2649dac
commit 436d50a01f
3 changed files with 20 additions and 6 deletions

View File

@ -15,31 +15,31 @@ namespace Aurora::IO
{ {
/** /**
* @brief Amount of bytes to transfer or zero if run until EoS/EoF * @brief Amount of bytes to transfer or zero if run until EoS/EoF
*/ */
AuUInt32 uLengthOrZero {}; AuUInt32 uLengthOrZero {};
/** /**
* @brief true if the underlying stream uses relative stream positions * @brief true if the underlying stream uses relative stream positions
* (IE: a network or pipe stream that cannot seek backwards and fowards) * (IE: a network or pipe stream that cannot seek backwards and fowards)
* (Inversely, file devices and similar IO subsystems use IO packets with absolute offsets) * (Inversely, file devices and similar IO subsystems use IO packets with absolute offsets)
*/ */
bool bIsStream {false}; bool bIsStream {false};
/** /**
* @brief internal frame size, that is one iteration of file or stream read, in bytes or zero if fallback * @brief internal frame size, that is one iteration of file or stream read, in bytes or zero if fallback
* Windows is inclined to read every single requested byte of a file stream asynchronously * Windows is inclined to read every single requested byte of a file stream asynchronously
* Streams, on all platforms, yield as soon as there is data available to copy over (usually) * Streams, on all platforms, yield as soon as there is data available to copy over (usually)
*/ */
AuUInt32 uPageLengthOrZero {}; AuUInt32 uPageLengthOrZero {};
/** /**
* @brief internal buffer size or zero if fallback * @brief internal buffer size or zero if fallback
*/ */
AuUInt32 uBufferLengthOrZero {}; AuUInt32 uBufferLengthOrZero {};
/** /**
* @brief event listener * @brief event listener
*/ */
AuSPtr<IIOPipeEventListener> pListener; AuSPtr<IIOPipeEventListener> pListener;
/** /**
@ -49,9 +49,16 @@ namespace Aurora::IO
* adjusting this variable permits for under-reads without failing the pipe transaction. * adjusting this variable permits for under-reads without failing the pipe transaction.
* *
* Recommended: 0 -> use uLengthOrZero * Recommended: 0 -> use uLengthOrZero
*/ */
AuUInt32 uMinBytesToRead {}; AuUInt32 uMinBytesToRead {};
/**
* If true, no uPage-related retardation will be considered for per frame ingest.
* The entire internal allocation will be used to read/recv data, unless overwritten by SetNextFrameTargetLength.
* If false, uPageLengthOrZero as a constraint will be respected unless overwritten by SetNextFrameTargetLength.
*/
bool bReadEntireAllocation {};
/** /**
* @brief Used as the buffer size for streams of page length 0 * @brief Used as the buffer size for streams of page length 0
*/ */

View File

@ -24,6 +24,7 @@ namespace Aurora::IO
this->uBufferSize_ = request.uBufferLengthOrZero ? request.uBufferLengthOrZero : request.kFallbackBufferSize; this->uBufferSize_ = request.uBufferLengthOrZero ? request.uBufferLengthOrZero : request.kFallbackBufferSize;
this->uBytesWrittenLimit_ = request.uLengthOrZero; this->uBytesWrittenLimit_ = request.uLengthOrZero;
this->uBytesWrittenTarget_ = request.uMinBytesToRead ? request.uMinBytesToRead : request.uLengthOrZero; this->uBytesWrittenTarget_ = request.uMinBytesToRead ? request.uMinBytesToRead : request.uLengthOrZero;
this->bReadEntireAllocation_ = request.bReadEntireAllocation;
this->pAsyncTransaction_ = request.pAsyncTransaction; this->pAsyncTransaction_ = request.pAsyncTransaction;
this->pAsyncAdapter_ = Adapters::NewAsyncStreamAdapter(request.pAsyncTransaction, request.bIsStream); this->pAsyncAdapter_ = Adapters::NewAsyncStreamAdapter(request.pAsyncTransaction, request.bIsStream);
SysAssert(this->pAsyncAdapter_); SysAssert(this->pAsyncAdapter_);
@ -41,6 +42,7 @@ namespace Aurora::IO
{ {
this->uBufferSize_ = request.uBufferLengthOrZero ? request.uBufferLengthOrZero : request.kFallbackBufferSize; this->uBufferSize_ = request.uBufferLengthOrZero ? request.uBufferLengthOrZero : request.kFallbackBufferSize;
this->uFrameCap_ = request.uPageLengthOrZero ? request.uPageLengthOrZero : request.kFallbackPageSize; this->uFrameCap_ = request.uPageLengthOrZero ? request.uPageLengthOrZero : request.kFallbackPageSize;
this->bReadEntireAllocation_ = request.bReadEntireAllocation;
this->uBytesWrittenLimit_ = request.uLengthOrZero; this->uBytesWrittenLimit_ = request.uLengthOrZero;
this->uBytesWrittenTarget_ = request.uMinBytesToRead ? request.uMinBytesToRead : request.uLengthOrZero; this->uBytesWrittenTarget_ = request.uMinBytesToRead ? request.uMinBytesToRead : request.uLengthOrZero;
} }
@ -378,6 +380,10 @@ namespace Aurora::IO
} }
else else
{ {
if (!this->bReadEntireAllocation_)
{
uBytesMax = AuMin(this->uFrameCap_, uBytesMax);
}
return uBytesMax; return uBytesMax;
} }
} }

View File

@ -132,6 +132,7 @@ namespace Aurora::IO
AuUInt uBytesWrittenLimit_ {}; AuUInt uBytesWrittenLimit_ {};
AuUInt uBytesWrittenTarget_ {}; AuUInt uBytesWrittenTarget_ {};
AuUInt uBytesPerFrame_ {}; AuUInt uBytesPerFrame_ {};
bool bReadEntireAllocation_ {};
AuByteBuffer buffer_; AuByteBuffer buffer_;
Aurora::Utility::ThroughputCalculator throughput_; Aurora::Utility::ThroughputCalculator throughput_;
AuUInt bytesProcessedInterframe_ {}; AuUInt bytesProcessedInterframe_ {};