Fix websocket error log handling
The commit b0ae71c[1] mishandles the error handling branches which
cause `operation_aborted` to be reported as an error.
```
else if (ec != <error-cases>)
{
BMCWEB_LOG_ERROR("doRead error {}", ec);
}
else if (ec == boost::asio::error::operation_aborted)
{
BMCWEB_LOG_WARNING("doRead operation is aborted: {}", ec);
}
```
This needs to handle `operation_aborted` first.
Tested:
- Unit test passes
[1] https://github.com/openbmc/bmcweb/commit/b0ae71c8f503b9e56a5bf88549346b15e7961e26
Change-Id: Ie4b0eafabcf41adf661ab3abc1fe1282c13d1d82
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/http/websocket_impl.hpp b/http/websocket_impl.hpp
index 72f31f1..d519073 100644
--- a/http/websocket_impl.hpp
+++ b/http/websocket_impl.hpp
@@ -245,16 +245,17 @@
{
BMCWEB_LOG_WARNING("doRead timeout: {}", ec);
}
+ else if (ec == boost::asio::error::operation_aborted)
+ {
+ BMCWEB_LOG_WARNING("doRead operation is aborted: {}", ec);
+ }
else if (ec != boost::beast::websocket::error::closed &&
ec != boost::asio::error::eof &&
ec != boost::asio::ssl::error::stream_truncated)
{
BMCWEB_LOG_ERROR("doRead error {}", ec);
}
- else if (ec == boost::asio::error::operation_aborted)
- {
- BMCWEB_LOG_WARNING("doRead operation is aborted: {}", ec);
- }
+
if (closeHandler)
{
std::string reason{ws.reason().reason.c_str()};