summaryrefslogtreecommitdiff
path: root/include/kvm_websocket.hpp
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2023-10-20 19:20:21 +0300
committerEd Tanous <ed@tanous.net>2023-10-24 21:17:16 +0300
commit5a39f77a17fa28911c87caea1e2903c059e7ec41 (patch)
treea2a2ff266238e7e9322e36eb2d9c92cf18829406 /include/kvm_websocket.hpp
parente9cc1bc93c4ad9662c93e2a98d4c787e2dbf9f07 (diff)
downloadbmcweb-5a39f77a17fa28911c87caea1e2903c059e7ec41.tar.xz
clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository. Change-Id: I2f9540cf0d545a2da4d6289fc87b754f684bc9a7 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'include/kvm_websocket.hpp')
-rw-r--r--include/kvm_websocket.hpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index d04c19fd93..0089ae375b 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -24,20 +24,20 @@ class KvmSession : public std::enable_shared_from_this<KvmSession>
boost::asio::ip::make_address("127.0.0.1"), 5900);
hostSocket.async_connect(
endpoint, [this, &connIn](const boost::system::error_code& ec) {
- if (ec)
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR(
+ "conn:{}, Couldn't connect to KVM socket port: {}",
+ logPtr(&conn), ec);
+ if (ec != boost::asio::error::operation_aborted)
{
- BMCWEB_LOG_ERROR(
- "conn:{}, Couldn't connect to KVM socket port: {}",
- logPtr(&conn), ec);
- if (ec != boost::asio::error::operation_aborted)
- {
- connIn.close("Error in connecting to KVM port");
- }
- return;
+ connIn.close("Error in connecting to KVM port");
}
+ return;
+ }
- doRead();
- });
+ doRead();
+ });
}
void onMessage(const std::string& data)
@@ -102,7 +102,7 @@ class KvmSession : public std::enable_shared_from_this<KvmSession>
outputBuffer.consume(bytesRead);
doRead();
- });
+ });
}
void doWrite()
@@ -152,7 +152,7 @@ class KvmSession : public std::enable_shared_from_this<KvmSession>
}
doWrite();
- });
+ });
}
crow::websocket::Connection& conn;
@@ -175,26 +175,26 @@ inline void requestRoutes(App& app)
.privileges({{"ConfigureComponents", "ConfigureManager"}})
.websocket()
.onopen([](crow::websocket::Connection& conn) {
- BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
+ BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
- if (sessions.size() == maxSessions)
- {
- conn.close("Max sessions are already connected");
- return;
- }
+ if (sessions.size() == maxSessions)
+ {
+ conn.close("Max sessions are already connected");
+ return;
+ }
- sessions[&conn] = std::make_shared<KvmSession>(conn);
- })
+ sessions[&conn] = std::make_shared<KvmSession>(conn);
+ })
.onclose([](crow::websocket::Connection& conn, const std::string&) {
- sessions.erase(&conn);
- })
+ sessions.erase(&conn);
+ })
.onmessage([](crow::websocket::Connection& conn,
const std::string& data, bool) {
- if (sessions[&conn])
- {
- sessions[&conn]->onMessage(data);
- }
- });
+ if (sessions[&conn])
+ {
+ sessions[&conn]->onMessage(data);
+ }
+ });
}
} // namespace obmc_kvm