Merge 2c35fe6238 into merged_master (Bitcoin PR #15849)

This commit is contained in:
Andrew Poelstra 2020-10-29 02:06:12 +00:00
commit 44e5901b98
19 changed files with 239 additions and 58 deletions

View file

@ -6,6 +6,7 @@
#include <chainparamsbase.h>
#include <compat.h>
#include <util/threadnames.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <netbase.h>
@ -17,7 +18,7 @@
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
@ -285,7 +286,7 @@ static void http_reject_request_cb(struct evhttp_request* req, void*)
/** Event dispatcher thread */
static bool ThreadHTTP(struct event_base* base)
{
RenameThread("bitcoin-http");
util::ThreadRename("http");
LogPrint(BCLog::HTTP, "Entering http event loop\n");
event_base_dispatch(base);
// Event loop will be interrupted by InterruptHTTPServer()
@ -336,9 +337,9 @@ static bool HTTPBindAddresses(struct evhttp* http)
}
/** Simple wrapper to set thread name and run work queue */
static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue)
static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue, int worker_num)
{
RenameThread("bitcoin-httpworker");
util::ThreadRename(strprintf("httpworker.%i", worker_num));
queue->Run();
}
@ -431,7 +432,7 @@ void StartHTTPServer()
threadHTTP = std::thread(ThreadHTTP, eventBase);
for (int i = 0; i < rpcThreads; i++) {
g_thread_http_workers.emplace_back(HTTPWorkQueueRun, workQueue);
g_thread_http_workers.emplace_back(HTTPWorkQueueRun, workQueue, i);
}
}