MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / canEndWritable

Method canEndWritable

Libraries/Http/HttpConnection.cpp:857–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857bool HttpOutgoingMessage::ChunkedWritableStream::canEndWritable()
858{
859 if (finalChunkWritten)
860 {
861 return true;
862 }
863 if (finalChunkStarted)
864 {
865 return false;
866 }
867
868 SC_HTTP_ASSERT_RELEASE(destination != nullptr);
869 finalChunkStarted = true;
870 Result finalWrite = destination->write(AsyncBufferView("0\r\n\r\n"), {[this](AsyncBufferView::ID writtenBufferID)
871 { onFinalChunkWritten(writtenBufferID); }});
872 if (not finalWrite)
873 {
874 eventError.emit(finalWrite);
875 finalChunkWritten = true;
876 destination->end();
877 return true;
878 }
879 return false;
880}
881
882void HttpOutgoingMessage::ChunkedWritableStream::onChunkHeaderWritten(AsyncBufferView::ID)
883{

Callers

nothing calls this directly

Calls 3

AsyncBufferViewFunction · 0.85
writeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected