Prep for boost 1.74.0
Boost 1.74.0 got released the yesterday and deprecated some more stuff
that we use. This patchset prepares us so we will build for it when
meta-oe picks it up.
Tested:
Code builds under boost 1.74.0
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Icc6c54da6705098fc76e3ee6dbdc6c3b5c57fbda
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6181fef..62e1b14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,9 +169,11 @@
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall")
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
- -fno-rtti \
-")
+# reenable when https://github.com/chriskohlhoff/asio/issues/533
+# is resolved. ASIO default executor doesn't build with no-rtti
+#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
+# -fno-rtti \
+#")
set (
CMAKE_CXX_FLAGS
@@ -300,6 +302,7 @@
include_directories (SYSTEM ${BOOST_SRC_DIR})
# add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
+add_definitions (-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
add_definitions (-DBOOST_BEAST_USE_STD_STRING_VIEW)
add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)
diff --git a/http/websocket.h b/http/websocket.h
index 5e65c99..61b3463 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -95,9 +95,7 @@
std::string_view protocol = req[bf::sec_websocket_protocol];
- // Perform the websocket upgrade
- ws.async_accept_ex(
- req,
+ ws.set_option(boost::beast::websocket::stream_base::decorator(
[session{session}, protocol{std::string(protocol)}](
boost::beast::websocket::response_type& m) {
@@ -126,15 +124,18 @@
m.insert("X-XSS-Protection", "1; "
"mode=block");
m.insert("X-Content-Type-Options", "nosniff");
- },
- [this, self(shared_from_this())](boost::system::error_code ec) {
- if (ec)
- {
- BMCWEB_LOG_ERROR << "Error in ws.async_accept " << ec;
- return;
- }
- acceptDone();
- });
+ }));
+
+ // Perform the websocket upgrade
+ ws.async_accept(req, [this, self(shared_from_this())](
+ boost::system::error_code ec) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "Error in ws.async_accept " << ec;
+ return;
+ }
+ acceptDone();
+ });
}
void sendBinary(const std::string_view msg) override
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index f2de85b..29efbef 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -4,6 +4,7 @@
#include <websocket.h>
#include <async_resp.hpp>
+#include <boost/asio/local/stream_protocol.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>