mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-25 04:55:50 +00:00
Always use co-routines:
This permits RPC handlers to suspend and reschedule:
This commit is contained in:
@@ -181,24 +181,12 @@ ServerHandlerImp::onRequest (HTTP::Session& session)
|
||||
|
||||
auto detach = session.detach();
|
||||
|
||||
if (setup_.yieldStrategy.useCoroutines ==
|
||||
RPC::YieldStrategy::UseCoroutines::yes)
|
||||
{
|
||||
RPC::SuspendCallback suspend (
|
||||
[this, detach] (RPC::Suspend const& suspend) {
|
||||
processSession (detach, suspend);
|
||||
});
|
||||
RPC::Coroutine coroutine (suspend);
|
||||
coroutine.run();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_jobQueue.addJob (
|
||||
jtCLIENT, "RPC-Client",
|
||||
[=] (Job&) {
|
||||
processSession (detach, RPC::Suspend());
|
||||
});
|
||||
}
|
||||
RPC::SuspendCallback suspend (
|
||||
[this, detach] (RPC::Suspend const& suspend) {
|
||||
processSession (detach, suspend);
|
||||
});
|
||||
RPC::Coroutine coroutine (suspend);
|
||||
coroutine.run();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user