mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-27 00:50:39 +00:00
style: clang-tidy auto fixes (#2958)
Co-authored-by: godexsoft <385326+godexsoft@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
2d6f82c27f
commit
af736717fc
@@ -78,10 +78,11 @@ makeAdminVerificationStrategy(util::config::ClioConfigDefinition const& config)
|
||||
auto adminPassword = config.maybeValue<std::string>("server.admin_password");
|
||||
auto const localAdmin = config.maybeValue<bool>("server.local_admin");
|
||||
|
||||
if (adminPassword.has_value() and localAdmin.has_value() and *localAdmin)
|
||||
if (adminPassword.has_value() and localAdmin.has_value() and *localAdmin) {
|
||||
return std::unexpected{
|
||||
"Admin config error: 'local_admin' and admin_password can not be set together."
|
||||
};
|
||||
}
|
||||
|
||||
if (localAdmin.has_value() and !*localAdmin and !adminPassword.has_value()) {
|
||||
return std::unexpected{
|
||||
|
||||
@@ -245,10 +245,11 @@ public:
|
||||
return sender_(httpResponse(http::status::ok, "text/html", kHEALTH_CHECK_HTML));
|
||||
|
||||
if (req_.method() == http::verb::get and req_.target() == "/cache_state") {
|
||||
if (cache_.get().isFull())
|
||||
if (cache_.get().isFull()) {
|
||||
return sender_(
|
||||
httpResponse(http::status::ok, "text/html", kCACHE_CHECK_LOADED_HTML)
|
||||
);
|
||||
}
|
||||
|
||||
return sender_(httpResponse(
|
||||
http::status::service_unavailable, "text/html", kCACHE_CHECK_NOT_LOADED_HTML
|
||||
|
||||
@@ -93,9 +93,10 @@ protected:
|
||||
wsFail(boost::beast::error_code ec, char const* what)
|
||||
{
|
||||
// Don't log if the WebSocket stream was gracefully closed at both endpoints
|
||||
if (ec != boost::beast::websocket::error::closed)
|
||||
if (ec != boost::beast::websocket::error::closed) {
|
||||
LOG(log_.error()) << tag() << ": " << what << ": " << ec.message() << ": "
|
||||
<< ec.value();
|
||||
}
|
||||
|
||||
if (!ec_ && ec != boost::asio::error::operation_aborted) {
|
||||
ec_ = ec;
|
||||
|
||||
@@ -161,9 +161,10 @@ public:
|
||||
<< connectionMetadata.tag() << "Adding to work queue";
|
||||
|
||||
if (not connectionMetadata.wasUpgraded() and
|
||||
shouldReplaceParams(parsedObject))
|
||||
shouldReplaceParams(parsedObject)) {
|
||||
parsedObject[JS(params)] =
|
||||
boost::json::array({boost::json::object{}});
|
||||
}
|
||||
|
||||
response = handleRequest(
|
||||
innerYield,
|
||||
|
||||
@@ -138,10 +138,11 @@ makeConnection(
|
||||
{
|
||||
impl::UpgradableConnectionPtr connection;
|
||||
if (sslDetectionResult.isSsl) {
|
||||
if (not sslContext.has_value())
|
||||
if (not sslContext.has_value()) {
|
||||
return std::unexpected{
|
||||
"Error creating a connection: SSL is not supported by this server"
|
||||
};
|
||||
}
|
||||
|
||||
auto sslConnection = std::make_unique<impl::SslHttpConnection>(
|
||||
std::move(sslDetectionResult.socket),
|
||||
@@ -152,10 +153,11 @@ makeConnection(
|
||||
);
|
||||
sslConnection->setTimeout(std::chrono::seconds{10});
|
||||
auto const expectedSuccess = sslConnection->sslHandshake(yield);
|
||||
if (not expectedSuccess.has_value())
|
||||
if (not expectedSuccess.has_value()) {
|
||||
return std::unexpected{
|
||||
fmt::format("SSL handshake error: {}", expectedSuccess.error().message())
|
||||
};
|
||||
}
|
||||
|
||||
connection = std::move(sslConnection);
|
||||
} else {
|
||||
|
||||
@@ -57,10 +57,11 @@ makeServerSslContext(util::config::ClioConfigDefinition const& config)
|
||||
bool const configHasCertFile = config.getValueView("ssl_cert_file").hasValue();
|
||||
bool const configHasKeyFile = config.getValueView("ssl_key_file").hasValue();
|
||||
|
||||
if (configHasCertFile != configHasKeyFile)
|
||||
if (configHasCertFile != configHasKeyFile) {
|
||||
return std::unexpected{
|
||||
"Config entries 'ssl_cert_file' and 'ssl_key_file' must be set or unset together."
|
||||
};
|
||||
}
|
||||
|
||||
if (not configHasCertFile)
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user