Enable unused variable warnings and resolve
This commit enables the "unused variables" warning in clang. Throughout
this, it did point out several issues that would've been functional
bugs, so I think it was worthwhile. It also cleaned up several unused
variable from old constructs that no longer exist.
Tested:
Built with clang. Code no longer emits warnings.
Downloaded bmcweb to system and pulled up the webui, observed webui
loads and logs in properly.
Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index d07469e..da9a06f 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -160,7 +160,7 @@
.privileges({"ConfigureComponents", "ConfigureManager"})
.websocket()
.onopen([](crow::websocket::Connection& conn,
- std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+ std::shared_ptr<bmcweb::AsyncResp>) {
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
if (session != nullptr)
@@ -183,16 +183,21 @@
handler = std::make_shared<Handler>(media, conn.get_io_context());
handler->connect();
})
- .onclose(
- [](crow::websocket::Connection& conn, const std::string& reason) {
- session = nullptr;
- handler->doClose();
- handler->inputBuffer->clear();
- handler->outputBuffer->clear();
- handler.reset();
- })
+ .onclose([](crow::websocket::Connection& conn,
+ const std::string& /*reason*/) {
+ if (&conn != session)
+ {
+ return;
+ }
+
+ session = nullptr;
+ handler->doClose();
+ handler->inputBuffer->clear();
+ handler->outputBuffer->clear();
+ handler.reset();
+ })
.onmessage([](crow::websocket::Connection& conn,
- const std::string& data, bool is_binary) {
+ const std::string& data, bool) {
if (data.length() > handler->inputBuffer->capacity())
{
BMCWEB_LOG_ERROR << "Buffer overrun when writing "