mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-25 10:48:20 +02:00
Avoid repeatedly calling stream->lowest_layer()
within the same scope & move some variable constructions
This commit is contained in:
parent
e074e892ce
commit
52b1b7ead3
@ -92,11 +92,12 @@ void HttpServerConnection::Disconnect()
|
|||||||
|
|
||||||
m_CheckLivenessTimer.cancel();
|
m_CheckLivenessTimer.cancel();
|
||||||
|
|
||||||
m_Stream->lowest_layer().cancel(ec);
|
auto& lowestLayer = m_Stream->lowest_layer();
|
||||||
|
lowestLayer.cancel(ec);
|
||||||
|
|
||||||
m_Stream->next_layer().async_shutdown(yc[ec]);
|
m_Stream->next_layer().async_shutdown(yc[ec]);
|
||||||
|
|
||||||
m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec);
|
lowestLayer.shutdown(lowestLayer.shutdown_both, ec);
|
||||||
|
|
||||||
auto listener (ApiListener::GetInstance());
|
auto listener (ApiListener::GetInstance());
|
||||||
|
|
||||||
@ -239,8 +240,6 @@ bool HandleAccessControl(
|
|||||||
auto headerAllowOrigin (listener->GetAccessControlAllowOrigin());
|
auto headerAllowOrigin (listener->GetAccessControlAllowOrigin());
|
||||||
|
|
||||||
if (headerAllowOrigin) {
|
if (headerAllowOrigin) {
|
||||||
CpuBoundWork allowOriginHeader (yc);
|
|
||||||
|
|
||||||
auto allowedOrigins (headerAllowOrigin->ToSet<String>());
|
auto allowedOrigins (headerAllowOrigin->ToSet<String>());
|
||||||
|
|
||||||
if (!allowedOrigins.empty()) {
|
if (!allowedOrigins.empty()) {
|
||||||
@ -250,8 +249,6 @@ bool HandleAccessControl(
|
|||||||
response.set(http::field::access_control_allow_origin, origin);
|
response.set(http::field::access_control_allow_origin, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
allowOriginHeader.Done();
|
|
||||||
|
|
||||||
response.set(http::field::access_control_allow_credentials, "true");
|
response.set(http::field::access_control_allow_credentials, "true");
|
||||||
|
|
||||||
if (request.method() == http::verb::options && !request[http::field::access_control_request_method].empty()) {
|
if (request.method() == http::verb::options && !request[http::field::access_control_request_method].empty()) {
|
||||||
|
@ -226,7 +226,8 @@ void JsonRpcConnection::Disconnect()
|
|||||||
m_CheckLivenessTimer.cancel();
|
m_CheckLivenessTimer.cancel();
|
||||||
m_HeartbeatTimer.cancel();
|
m_HeartbeatTimer.cancel();
|
||||||
|
|
||||||
m_Stream->lowest_layer().cancel(ec);
|
auto& lowestLayer = m_Stream->lowest_layer();
|
||||||
|
lowestLayer.cancel(ec);
|
||||||
|
|
||||||
Timeout::Ptr shutdownTimeout (new Timeout(
|
Timeout::Ptr shutdownTimeout (new Timeout(
|
||||||
m_IoStrand.context(),
|
m_IoStrand.context(),
|
||||||
@ -242,7 +243,7 @@ void JsonRpcConnection::Disconnect()
|
|||||||
|
|
||||||
shutdownTimeout->Cancel();
|
shutdownTimeout->Cancel();
|
||||||
|
|
||||||
m_Stream->lowest_layer().shutdown(m_Stream->lowest_layer().shutdown_both, ec);
|
lowestLayer.shutdown(lowestLayer.shutdown_both, ec);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user