@@ -568,7 +568,7 @@ template <typename Client>
568
568
void clientDestroy (Client& client)
569
569
{
570
570
if (client.m_context .connection ) {
571
- client.m_context .connection -> m_loop . log () << " IPC client destroy " << typeid (client).name ();
571
+ client.m_context .loop -> log () << " IPC client destroy " << typeid (client).name ();
572
572
} else {
573
573
KJ_LOG (INFO, " IPC interrupted client destroy" , typeid (client).name ());
574
574
}
@@ -577,7 +577,7 @@ void clientDestroy(Client& client)
577
577
template <typename Server>
578
578
void serverDestroy (Server& server)
579
579
{
580
- server.m_context .connection -> m_loop . log () << " IPC server destroy " << typeid (server).name ();
580
+ server.m_context .loop -> log () << " IPC server destroy " << typeid (server).name ();
581
581
}
582
582
583
583
// ! Entry point called by generated client code that looks like:
@@ -597,7 +597,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
597
597
}
598
598
if (!g_thread_context.waiter ) {
599
599
assert (g_thread_context.thread_name .empty ());
600
- g_thread_context.thread_name = ThreadName (proxy_client.m_context .connection -> m_loop . m_exe_name );
600
+ g_thread_context.thread_name = ThreadName (proxy_client.m_context .loop -> m_exe_name );
601
601
// If next assert triggers, it means clientInvoke is being called from
602
602
// the capnp event loop thread. This can happen when a ProxyServer
603
603
// method implementation that runs synchronously on the event loop
@@ -608,26 +608,26 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
608
608
// declaration so the server method runs in a dedicated thread.
609
609
assert (!g_thread_context.loop_thread );
610
610
g_thread_context.waiter = std::make_unique<Waiter>();
611
- proxy_client.m_context .connection -> m_loop . logPlain ()
611
+ proxy_client.m_context .loop -> logPlain ()
612
612
<< " {" << g_thread_context.thread_name
613
613
<< " } IPC client first request from current thread, constructing waiter" ;
614
614
}
615
615
ClientInvokeContext invoke_context{*proxy_client.m_context .connection , g_thread_context};
616
616
std::exception_ptr exception;
617
617
std::string kj_exception;
618
618
bool done = false ;
619
- proxy_client.m_context .connection -> m_loop . sync ([&]() {
619
+ proxy_client.m_context .loop -> sync ([&]() {
620
620
auto request = (proxy_client.m_client .*get_request)(nullptr );
621
621
using Request = CapRequestTraits<decltype (request)>;
622
622
using FieldList = typename ProxyClientMethodTraits<typename Request::Params>::Fields;
623
623
IterateFields ().handleChain (invoke_context, request, FieldList (), typename FieldObjs::BuildParams{&fields}...);
624
- proxy_client.m_context .connection -> m_loop . logPlain ()
624
+ proxy_client.m_context .loop -> logPlain ()
625
625
<< " {" << invoke_context.thread_context .thread_name << " } IPC client send "
626
626
<< TypeName<typename Request::Params>() << " " << LogEscape (request.toString ());
627
627
628
- proxy_client.m_context .connection -> m_loop . m_task_set ->add (request.send ().then (
628
+ proxy_client.m_context .loop -> m_task_set ->add (request.send ().then (
629
629
[&](::capnp::Response<typename Request::Results>&& response) {
630
- proxy_client.m_context .connection -> m_loop . logPlain ()
630
+ proxy_client.m_context .loop -> logPlain ()
631
631
<< " {" << invoke_context.thread_context .thread_name << " } IPC client recv "
632
632
<< TypeName<typename Request::Results>() << " " << LogEscape (response.toString ());
633
633
try {
@@ -642,7 +642,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
642
642
},
643
643
[&](const ::kj::Exception& e) {
644
644
kj_exception = kj::str (" kj::Exception: " , e).cStr ();
645
- proxy_client.m_context .connection -> m_loop . logPlain ()
645
+ proxy_client.m_context .loop -> logPlain ()
646
646
<< " {" << invoke_context.thread_context .thread_name << " } IPC client exception " << kj_exception;
647
647
const std::unique_lock<std::mutex> lock (invoke_context.thread_context .waiter ->m_mutex );
648
648
done = true ;
@@ -653,7 +653,7 @@ void clientInvoke(ProxyClient& proxy_client, const GetRequest& get_request, Fiel
653
653
std::unique_lock<std::mutex> lock (invoke_context.thread_context .waiter ->m_mutex );
654
654
invoke_context.thread_context .waiter ->wait (lock, [&done]() { return done; });
655
655
if (exception) std::rethrow_exception (exception);
656
- if (!kj_exception.empty ()) proxy_client.m_context .connection -> m_loop . raise () << kj_exception;
656
+ if (!kj_exception.empty ()) proxy_client.m_context .loop -> raise () << kj_exception;
657
657
}
658
658
659
659
// ! Invoke callable `fn()` that may return void. If it does return void, replace
@@ -687,7 +687,7 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
687
687
using Results = typename decltype (call_context.getResults ())::Builds;
688
688
689
689
int req = ++server_reqs;
690
- server.m_context .connection -> m_loop . log () << " IPC server recv request #" << req << " "
690
+ server.m_context .loop -> log () << " IPC server recv request #" << req << " "
691
691
<< TypeName<typename Params::Reads>() << " " << LogEscape (params.toString ());
692
692
693
693
try {
@@ -704,14 +704,14 @@ kj::Promise<void> serverInvoke(Server& server, CallContext& call_context, Fn fn)
704
704
return ReplaceVoid ([&]() { return fn.invoke (server_context, ArgList ()); },
705
705
[&]() { return kj::Promise<CallContext>(kj::mv (call_context)); })
706
706
.then ([&server, req](CallContext call_context) {
707
- server.m_context .connection -> m_loop . log () << " IPC server send response #" << req << " " << TypeName<Results>()
707
+ server.m_context .loop -> log () << " IPC server send response #" << req << " " << TypeName<Results>()
708
708
<< " " << LogEscape (call_context.getResults ().toString ());
709
709
});
710
710
} catch (const std::exception& e) {
711
- server.m_context .connection -> m_loop . log () << " IPC server unhandled exception: " << e.what ();
711
+ server.m_context .loop -> log () << " IPC server unhandled exception: " << e.what ();
712
712
throw ;
713
713
} catch (...) {
714
- server.m_context .connection -> m_loop . log () << " IPC server unhandled exception" ;
714
+ server.m_context .loop -> log () << " IPC server unhandled exception" ;
715
715
throw ;
716
716
}
717
717
}
0 commit comments