Skip to content

Commit 9d06822

Browse files
committed
multiprocess: update multiprocess EventLoop construction to use options
This uses the constructors recently added upstream.
1 parent d298710 commit 9d06822

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/ipc/capnp/protocol.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
namespace ipc {
3131
namespace capnp {
3232
namespace {
33-
void IpcLogFn(bool raise, std::string message)
33+
void IpcLogFn(mp::LogMessage message)
3434
{
35-
LogDebug(BCLog::IPC, "%s\n", message);
36-
if (raise) throw Exception(message);
35+
LogDebug(BCLog::IPC, "%s\n", message.message);
36+
if (message.level == mp::Log::Raise) throw Exception(message.message);
3737
}
3838

3939
class CapnpProtocol : public Protocol
@@ -62,7 +62,10 @@ class CapnpProtocol : public Protocol
6262
{
6363
assert(!m_loop);
6464
mp::g_thread_context.thread_name = mp::ThreadName(exe_name);
65-
m_loop.emplace(exe_name, &IpcLogFn, &m_context);
65+
mp::LogOptions opts = {
66+
.log_fn = IpcLogFn,
67+
};
68+
m_loop.emplace(exe_name, std::move(opts), &m_context);
6669
if (ready_fn) ready_fn();
6770
mp::ServeStream<messages::Init>(*m_loop, fd, init);
6871
m_parent_connection = &m_loop->m_incoming_connections.back();
@@ -90,7 +93,10 @@ class CapnpProtocol : public Protocol
9093
std::promise<void> promise;
9194
m_loop_thread = std::thread([&] {
9295
util::ThreadRename("capnp-loop");
93-
m_loop.emplace(exe_name, &IpcLogFn, &m_context);
96+
mp::LogOptions opts = {
97+
.log_fn = IpcLogFn,
98+
};
99+
m_loop.emplace(exe_name, std::move(opts), &m_context);
94100
m_loop_ref.emplace(*m_loop);
95101
promise.set_value();
96102
m_loop->loop();

0 commit comments

Comments
 (0)