multiprocess: update multiprocess EventLoop construction to use options

This uses the constructors recently added upstream.
This commit is contained in:
Cory Fields 2025-10-01 14:41:40 +00:00
parent eda91b07fd
commit 6c1de3ead9
1 changed files with 11 additions and 5 deletions

View File

@ -30,10 +30,10 @@
namespace ipc {
namespace capnp {
namespace {
void IpcLogFn(bool raise, std::string message)
void IpcLogFn(mp::LogMessage message)
{
LogDebug(BCLog::IPC, "%s\n", message);
if (raise) throw Exception(message);
LogDebug(BCLog::IPC, "%s\n", message.message);
if (message.level == mp::Log::Raise) throw Exception(message.message);
}
class CapnpProtocol : public Protocol
@ -62,7 +62,10 @@ public:
{
assert(!m_loop);
mp::g_thread_context.thread_name = mp::ThreadName(exe_name);
m_loop.emplace(exe_name, &IpcLogFn, &m_context);
mp::LogOptions opts = {
.log_fn = IpcLogFn,
};
m_loop.emplace(exe_name, std::move(opts), &m_context);
if (ready_fn) ready_fn();
mp::ServeStream<messages::Init>(*m_loop, fd, init);
m_parent_connection = &m_loop->m_incoming_connections.back();
@ -90,7 +93,10 @@ public:
std::promise<void> promise;
m_loop_thread = std::thread([&] {
util::ThreadRename("capnp-loop");
m_loop.emplace(exe_name, &IpcLogFn, &m_context);
mp::LogOptions opts = {
.log_fn = IpcLogFn,
};
m_loop.emplace(exe_name, std::move(opts), &m_context);
m_loop_ref.emplace(*m_loop);
promise.set_value();
m_loop->loop();