Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/mp/proxy-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class EventLoop
{
public:
//! Construct event loop object.
EventLoop(const char* exe_name, LogFn log_fn);
EventLoop(const char* exe_name, LogFn log_fn, void* context = nullptr);
~EventLoop();

//! Run event loop. Does not return until shutdown. This should only be
Expand Down Expand Up @@ -204,7 +204,11 @@ class EventLoop
//! List of connections.
std::list<Connection> m_incoming_connections;

//! External logging callback.
LogFn m_log_fn;

//! External context pointer.
void* m_context;
};

//! Single element task queue used to handle recursive capnp calls. (If server
Expand Down
4 changes: 2 additions & 2 deletions src/mp/proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ void Connection::addAsyncCleanup(std::function<void()> fn)
m_async_cleanup_fns.emplace(m_async_cleanup_fns.begin(), std::move(fn));
}

EventLoop::EventLoop(const char* exe_name, LogFn log_fn)
: m_exe_name(exe_name), m_io_context(kj::setupAsyncIo()), m_log_fn(std::move(log_fn))
EventLoop::EventLoop(const char* exe_name, LogFn log_fn, void* context)
: m_exe_name(exe_name), m_io_context(kj::setupAsyncIo()), m_log_fn(std::move(log_fn)), m_context(context)
{
int fds[2];
KJ_SYSCALL(socketpair(AF_UNIX, SOCK_STREAM, 0, fds));
Expand Down