MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Flush

Method Flush

lib/remote/httpmessage.cpp:155–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154template<bool isRequest, typename Body, typename StreamVariant>
155void OutgoingHttpMessage<isRequest, Body, StreamVariant>::Flush(boost::asio::yield_context yc, bool finish)
156{
157 m_CpuBoundWork.reset();
158
159 if (!Base::chunked() && !Base::has_content_length()) {
160 ASSERT(!m_SerializationStarted);
161 Base::prepare_payload();
162 }
163
164 std::visit(
165 [&](auto& stream) {
166 m_SerializationStarted = true;
167
168 if (!m_Serializer.is_header_done()) {
169 boost::beast::http::write_header(*stream, m_Serializer);
170 }
171
172 if (finish) {
173 Base::body().Finish();
174 }
175
176 boost::system::error_code ec;
177 boost::beast::http::async_write(*stream, m_Serializer, yc[ec]);
178 if (ec && ec != boost::beast::http::error::need_buffer) {
179 if (yc.ec_) {
180 *yc.ec_ = ec;
181 return;
182 }
183 BOOST_THROW_EXCEPTION(boost::system::system_error{ec});
184 }
185 stream->async_flush(yc);
186
187 ASSERT(m_Serializer.is_done() || !Base::body().Finished());
188 },
189 m_Stream
190 );
191}
192
193template<bool isRequest, typename Body, typename StreamVariant>
194void OutgoingHttpMessage<isRequest, Body, StreamVariant>::StartStreaming()

Callers 9

MayFlushMethod · 0.45
HandleRequestMethod · 0.45
EnsureValidHeadersFunction · 0.45
HandleExpect100Function · 0.45
HandleAccessControlFunction · 0.45
EnsureAcceptHeaderFunction · 0.45
EnsureAuthenticatedUserFunction · 0.45
EnsureValidBodyFunction · 0.45
ProcessRequestFunction · 0.45

Calls 2

FinishMethod · 0.80
FinishedMethod · 0.80

Tested by

no test coverage detected