More debug thread name fixes

This commit is contained in:
SChernykh
2025-03-16 14:39:56 +01:00
parent 2449366d87
commit a55858b44f
3 changed files with 28 additions and 9 deletions
+2 -2
View File
@@ -80,8 +80,8 @@ void p2pool_usage()
"--rpc-ssl Enable SSL on RPC connections to the Monero node\n" "--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" "--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)\n"
#endif #endif
"--no-stratum-http Disable HTTP on Stratum ports\n" "--no-stratum-http Disable HTTP on Stratum ports\n"
"--help Show this help message\n\n" "--help Show this help message\n\n"
"Example command line:\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", "%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, p2pool::VERSION,
+2
View File
@@ -334,6 +334,8 @@ void MergeMiningClientTari::run()
{ {
LOGINFO(1, "worker thread ready"); LOGINFO(1, "worker thread ready");
set_thread_name("MM Tari poll");
using namespace std::chrono; using namespace std::chrono;
for (;;) { for (;;) {
+24 -7
View File
@@ -616,15 +616,32 @@ void TCPServer::loop(void* data)
log_category_prefix = server->get_log_category(); log_category_prefix = server->get_log_category();
{ {
char buf[64] = {}; size_t n = strlen(log_category_prefix);
log::Stream s(buf);
s << log_category_prefix;
if (s.m_pos > 0) { if (n > 1) {
buf[s.m_pos - 1] = '\0'; // 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"); LOGINFO(1, "event loop started");