Get the number of bytes left for continuous writing static*/
| 394 | |
| 395 | // Get the number of bytes left for continuous writing |
| 396 | /*static*/ size_t OutputBuffer::GetBytesLeft(const OutputBuffer *writingBuffer) noexcept |
| 397 | { |
| 398 | const size_t freeBuffers = OUTPUT_BUFFER_COUNT - usedOutputBuffers; |
| 399 | const size_t bytesLeft = OUTPUT_BUFFER_SIZE - writingBuffer->last->DataLength(); |
| 400 | |
| 401 | if (freeBuffers < RESERVED_OUTPUT_BUFFERS) |
| 402 | { |
| 403 | // Keep some space left to encapsulate the responses (e.g. via an HTTP header) |
| 404 | return bytesLeft; |
| 405 | } |
| 406 | |
| 407 | return bytesLeft + (freeBuffers - RESERVED_OUTPUT_BUFFERS) * OUTPUT_BUFFER_SIZE; |
| 408 | } |
| 409 | |
| 410 | // Truncate an output buffer to free up more memory. Returns the number of released bytes. |
| 411 | // This never releases the first buffer in the chain, so call it with a large value of bytesNeeded to release all buffers except the first. |
nothing calls this directly
no test coverage detected