diff --git a/src/main.cpp b/src/main.cpp index 81f7bd7..3eb8925 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,8 +80,8 @@ void p2pool_usage() "--rpc-ssl Enable SSL on RPC connections to the Monero node\n" "--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)\n" #endif - "--no-stratum-http Disable HTTP on Stratum ports\n" - "--help Show this help message\n\n" + "--no-stratum-http Disable HTTP on Stratum ports\n" + "--help Show this help message\n\n" "Example command line:\n\n" "%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n", p2pool::VERSION, diff --git a/src/merge_mining_client_tari.cpp b/src/merge_mining_client_tari.cpp index f9aa533..285e6df 100644 --- a/src/merge_mining_client_tari.cpp +++ b/src/merge_mining_client_tari.cpp @@ -334,6 +334,8 @@ void MergeMiningClientTari::run() { LOGINFO(1, "worker thread ready"); + set_thread_name("MM Tari poll"); + using namespace std::chrono; for (;;) { diff --git a/src/tcp_server.cpp b/src/tcp_server.cpp index b636035..3a892e9 100644 --- a/src/tcp_server.cpp +++ b/src/tcp_server.cpp @@ -616,15 +616,32 @@ void TCPServer::loop(void* data) log_category_prefix = server->get_log_category(); { - char buf[64] = {}; - log::Stream s(buf); - s << log_category_prefix; + size_t n = strlen(log_category_prefix); - if (s.m_pos > 0) { - buf[s.m_pos - 1] = '\0'; + if (n > 1) { + // Discard the last character (space) + --n; + + char buf[16] = {}; + + if (n < sizeof(buf)) { + // Set the thread name as is + memcpy(buf, log_category_prefix, n); + } + else { + // Thread name is too long, use the "first 7 characters - last 7 characters" format + constexpr size_t k = sizeof(buf) / 2 - 1; + + memcpy(buf, log_category_prefix, k); + buf[k] = '-'; + memcpy(buf + k + 1, log_category_prefix + n - k, k); + } + + set_thread_name(buf); + } + else { + set_thread_name("TCPServer"); } - - set_thread_name(buf); } LOGINFO(1, "event loop started");