@@ -558,7 +558,7 @@ template <typename Client>
558
558
void clientDestroy (Client& client)
559
559
{
560
560
if (client.m_context .connection ) {
561
- client.m_context .connection -> m_loop . log () << " IPC client destroy " << typeid (client).name ();
561
+ client.m_context .loop -> log () << " IPC client destroy " << typeid (client).name ();
562
562
} else {
563
563
KJ_LOG (INFO, " IPC interrupted client destroy" , typeid (client).name ());
564
564
}
@@ -567,7 +567,7 @@ void clientDestroy(Client& client)
567
567
template <typename Server>
568
568
void serverDestroy (Server& server)
569
569
{
570
- server.m_context .connection -> m_loop . log () << " IPC server destroy " << typeid (server).name ();
570
+ server.m_context .loop -> log () << " IPC server destroy " << typeid (server).name ();
571
571
}
572
572
573
573
// ! Entry point called by generated client code that looks like:
@@ -587,7 +587,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
587
587
}
588
588
if (!g_thread_context.waiter ) {
589
589
assert (g_thread_context.thread_name .empty ());
590
- g_thread_context.thread_name = ThreadName (proxy_client.m_context .connection -> m_loop . m_exe_name );
590
+ g_thread_context.thread_name = ThreadName (proxy_client.m_context .loop -> m_exe_name );
591
591
// If next assert triggers, it means clientInvoke is being called from
592
592
// the capnp event loop thread. This can happen when a ProxyServer
593
593
// method implementation that runs synchronously on the event loop
@@ -598,26 +598,26 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
598
598
// declaration so the server method runs in a dedicated thread.
599
599
assert (!g_thread_context.loop_thread );
600
600
g_thread_context.waiter = std::make_unique<Waiter>();
601
- proxy_client.m_context .connection -> m_loop . logPlain ()
601
+ proxy_client.m_context .loop -> logPlain ()
602
602
<< " {" << g_thread_context.thread_name
603
603
<< " } IPC client first request from current thread, constructing waiter" ;
604
604
}
605
605
ClientInvokeContext invoke_context{*proxy_client.m_context .connection , g_thread_context};
606
606
std::exception_ptr exception ;
607
607
std::string kj_exception;
608
608
bool done = false ;
609
- proxy_client.m_context .connection -> m_loop . sync ([&]() {
609
+ proxy_client.m_context .loop -> sync ([&]() {
610
610
auto request = (proxy_client.m_client .*get_request)(nullptr );
611
611
using Request = CapRequestTraits<decltype (request)>;
612
612
using FieldList = typename ProxyClientMethodTraits<typename Request::Params>::Fields;
613
613
IterateFields ().handleChain (invoke_context, request, FieldList (), typename FieldObjs::BuildParams{&fields}...);
614
- proxy_client.m_context .connection -> m_loop . logPlain ()
614
+ proxy_client.m_context .loop -> logPlain ()
615
615
<< " {" << invoke_context.thread_context .thread_name << " } IPC client send "
616
616
<< TypeName<typename Request::Params>() << " " << LogEscape (request.toString ());
617
617
618
- proxy_client.m_context .connection -> m_loop . m_task_set ->add (request.send ().then (
618
+ proxy_client.m_context .loop -> m_task_set ->add (request.send ().then (
619
619
[&](::capnp::Response<typename Request::Results>&& response) {
620
- proxy_client.m_context .connection -> m_loop . logPlain ()
620
+ proxy_client.m_context .loop -> logPlain ()
621
621
<< " {" << invoke_context.thread_context .thread_name << " } IPC client recv "
622
622
<< TypeName<typename Request::Results>() << " " << LogEscape (response.toString ());
623
623
try {
@@ -632,7 +632,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
632
632
},
633
633
[&](const ::kj::Exception& e) {
634
634
kj_exception = kj::str (" kj::Exception: " , e).cStr ();
635
- proxy_client.m_context .connection -> m_loop . logPlain ()
635
+ proxy_client.m_context .loop -> logPlain ()
636
636
<< " {" << invoke_context.thread_context .thread_name << " } IPC client exception " << kj_exception;
637
637
const std::unique_lock<std::mutex> lock (invoke_context.thread_context .waiter ->m_mutex );
638
638
done = true ;
@@ -643,7 +643,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
643
643
std::unique_lock<std::mutex> lock (invoke_context.thread_context .waiter ->m_mutex );
644
644
invoke_context.thread_context .waiter ->wait (lock, [&done]() { return done; });
645
645
if (exception ) std::rethrow_exception (exception );
646
- if (!kj_exception.empty ()) proxy_client.m_context .connection -> m_loop . raise () << kj_exception;
646
+ if (!kj_exception.empty ()) proxy_client.m_context .loop -> raise () << kj_exception;
647
647
}
648
648
649
649
// ! Invoke callable `fn()` that may return void. If it does return void, replace
@@ -682,7 +682,7 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
682
682
using Results = typename decltype (call_context.getResults ())::Builds;
683
683
684
684
int req = ++server_reqs;
685
- server.m_context .connection -> m_loop . log () << " IPC server recv request #" << req << " "
685
+ server.m_context .loop -> log () << " IPC server recv request #" << req << " "
686
686
<< TypeName<typename Params::Reads>() << " " << LogEscape (params.toString ());
687
687
688
688
try {
@@ -699,14 +699,14 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
699
699
return ReplaceVoid ([&]() { return fn.invoke (server_context, ArgList ()); },
700
700
[&]() { return kj::Promise<CallContext>(kj::mv (call_context)); })
701
701
.then ([&server, req](CallContext call_context) {
702
- server.m_context .connection -> m_loop . log () << " IPC server send response #" << req << " " << TypeName<Results>()
702
+ server.m_context .loop -> log () << " IPC server send response #" << req << " " << TypeName<Results>()
703
703
<< " " << LogEscape (call_context.getResults ().toString ());
704
704
});
705
705
} catch (const std::exception & e) {
706
- server.m_context .connection -> m_loop . log () << " IPC server unhandled exception: " << e.what ();
706
+ server.m_context .loop -> log () << " IPC server unhandled exception: " << e.what ();
707
707
throw ;
708
708
} catch (...) {
709
- server.m_context .connection -> m_loop . log () << " IPC server unhandled exception" ;
709
+ server.m_context .loop -> log () << " IPC server unhandled exception" ;
710
710
throw ;
711
711
}
712
712
}
0 commit comments