diff --git a/CMakeLists.txt b/CMakeLists.txt index 861c27c56..ed39943e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.15.0) project(Poco) +if(APPLE) + set(MYSQL_ROOT_DIR /usr/local/opt/mysql-client) + set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) +endif() + file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION) # Read the version information from the VERSION file file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION) @@ -58,6 +63,10 @@ include(GNUInstallDirs) # Include some common macros to simpilfy the Poco CMake files include(PocoMacros) +if(BROKEN_MYSQL_RESET) + add_definitions(-DBROKEN_MYSQL_RESET=1) +endif() + option(BUILD_SHARED_LIBS "Build using shared libraries" ON) set(POCO_SANITIZEFLAGS CACHE STRING "Compiler-dependent sanitizer flags (like -fsanitize=address or /fsanitize=address") diff --git a/Data/MySQL/src/SessionHandle.cpp b/Data/MySQL/src/SessionHandle.cpp index 6a167a131..a517141bd 100644 --- a/Data/MySQL/src/SessionHandle.cpp +++ b/Data/MySQL/src/SessionHandle.cpp @@ -188,7 +188,9 @@ void SessionHandle::autoCommit(bool val) void SessionHandle::reset() { -#if ((defined (MYSQL_VERSION_ID)) && (MYSQL_VERSION_ID >= 50700)) || ((defined (MARIADB_PACKAGE_VERSION_ID)) && (MARIADB_PACKAGE_VERSION_ID >= 30000)) +#if (defined(BROKEN_MYSQL_RESET)) + if (mysql_refresh(_pHandle, REFRESH_TABLES | REFRESH_STATUS | REFRESH_THREADS | REFRESH_READ_LOCK) != 0) +#elif ((defined (MYSQL_VERSION_ID)) && (MYSQL_VERSION_ID >= 50700)) || ((defined (MARIADB_PACKAGE_VERSION_ID)) && (MARIADB_PACKAGE_VERSION_ID >= 30000)) if (mysql_reset_connection(_pHandle) != 0) #else if (mysql_refresh(_pHandle, REFRESH_TABLES | REFRESH_STATUS | REFRESH_THREADS | REFRESH_READ_LOCK) != 0) diff --git a/Data/include/Poco/Data/TypeHandler.h b/Data/include/Poco/Data/TypeHandler.h index 330e0159c..0f7e400af 100644 --- a/Data/include/Poco/Data/TypeHandler.h +++ b/Data/include/Poco/Data/TypeHandler.h @@ -276,7 +276,7 @@ public: poco_assert_dbg (!pPreparator.isNull()); if (obj.isNull()) { - pPreparator->prepare(pos++, T()); + pPreparator->prepare(pos++, Poco::Data::Keywords::null)); } else { diff --git a/Net/include/Poco/Net/TCPServerParams.h b/Net/include/Poco/Net/TCPServerParams.h index 362b9c6ee..e38f76d45 100644 --- a/Net/include/Poco/Net/TCPServerParams.h +++ b/Net/include/Poco/Net/TCPServerParams.h @@ -91,6 +91,13 @@ public: Poco::Thread::Priority getThreadPriority() const; /// Returns the priority of TCP server threads /// created by TCPServer. + + void setName(const std::string &name); + /// Set the name of the underlying thread + // created vy TCPserver + + std::string getName() const; + /// Get the name of the underlying thread protected: virtual ~TCPServerParams(); @@ -101,6 +108,7 @@ private: int _maxThreads; int _maxQueued; Poco::Thread::Priority _threadPriority; + std::string _name; }; diff --git a/Net/include/Poco/Net/WebSocketImpl.h b/Net/include/Poco/Net/WebSocketImpl.h index ee8ede76d..8217beb2f 100644 --- a/Net/include/Poco/Net/WebSocketImpl.h +++ b/Net/include/Poco/Net/WebSocketImpl.h @@ -103,6 +103,8 @@ public: /// Returns the maximum payload size for receiveFrame(). /// /// The default is std::numeric_limits::max(). + + auto * streamSocketImpl() { return _pStreamSocketImpl; } protected: enum diff --git a/Net/src/TCPServer.cpp b/Net/src/TCPServer.cpp index ebf48a7e6..9223650c3 100644 --- a/Net/src/TCPServer.cpp +++ b/Net/src/TCPServer.cpp @@ -125,6 +125,19 @@ void TCPServer::stop() void TCPServer::run() { + + if(!_pDispatcher->params().getName().empty()) { + Poco::Thread::current()->setName(_pDispatcher->params().getName()); +#ifdef __linux__ + Poco::Thread::current()->setName(_pDispatcher->params().getName()); + pthread_setname_np(pthread_self(), _pDispatcher->params().getName().c_str()); +#endif +#ifdef __APPLE__ + Poco::Thread::current()->setName(_pDispatcher->params().getName()); + pthread_setname_np(_pDispatcher->params().getName().c_str()); +#endif + } + while (!_stopped) { Poco::Timespan timeout(250000); diff --git a/Net/src/TCPServerDispatcher.cpp b/Net/src/TCPServerDispatcher.cpp index d798ba8f5..3cbec4229 100644 --- a/Net/src/TCPServerDispatcher.cpp +++ b/Net/src/TCPServerDispatcher.cpp @@ -101,6 +101,18 @@ void TCPServerDispatcher::run() int idleTime = (int) _pParams->getThreadIdleTime().totalMilliseconds(); + if(!_pParams->getName().empty()) { + Poco::Thread::current()->setName(_pParams->getName()); +#ifdef __linux__ + Poco::Thread::current()->setName(_pParams->getName()); + pthread_setname_np(pthread_self(), _pParams->getName().c_str()); +#endif +#ifdef __APPLE__ + Poco::Thread::current()->setName(_pParams->getName()); + pthread_setname_np(_pParams->getName().c_str()); +#endif + } + for (;;) { try diff --git a/Net/src/TCPServerParams.cpp b/Net/src/TCPServerParams.cpp index 6a90374ab..c1aeef31f 100644 --- a/Net/src/TCPServerParams.cpp +++ b/Net/src/TCPServerParams.cpp @@ -60,5 +60,13 @@ void TCPServerParams::setThreadPriority(Poco::Thread::Priority prio) _threadPriority = prio; } +void TCPServerParams::setName(const std::string &name) { + _name = name; +} + +std::string TCPServerParams::getName() const { + return _name; +} + } } // namespace Poco::Net