From 78837a4a2b292f9c4d55b138a0c236f6bd28c728 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 4 Aug 2022 23:25:06 -0700 Subject: [PATCH] More ifdefs!!! --- src/WSServer.cpp | 6 +++++- src/WSServer.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/WSServer.cpp b/src/WSServer.cpp index 66559fc8..429c1cfa 100644 --- a/src/WSServer.cpp +++ b/src/WSServer.cpp @@ -43,8 +43,12 @@ using websocketpp::lib::bind; WSServer::WSServer() : QObject(nullptr), +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) _connections(), _clMutex(QMutex::Recursive) +#else + _connections() +#endif { _server.get_alog().clear_channels(websocketpp::log::alevel::frame_header | websocketpp::log::alevel::frame_payload | websocketpp::log::alevel::control); _server.init_asio(); @@ -227,7 +231,7 @@ void WSServer::onMessage(connection_hdl hdl, server::message_ptr message) #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QtConcurrent::run(&_threadPool, [=]() { #else - _threadPool::run([=]() { + _threadPool.start([=]() { #endif std::string payload = message->get_payload(); diff --git a/src/WSServer.h b/src/WSServer.h index d8a4877d..d5d7e84e 100644 --- a/src/WSServer.h +++ b/src/WSServer.h @@ -21,7 +21,11 @@ with this program. If not, see #include #include #include +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #include +#else +#include +#endif #include #include #include @@ -70,6 +74,11 @@ private: bool _lockToIPv4; std::set> _connections; std::map> _connectionProperties; +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QMutex _clMutex; +#else + QRecursiveMutex _clMutex; +#endif + QThreadPool _threadPool; };