Always use co-routines:

This permits RPC handlers to suspend and reschedule:
This commit is contained in:
JoelKatz
2015-06-17 12:39:28 -07:00
committed by Vinnie Falco
parent 48d6a4ab6a
commit 3d6e76046c
3 changed files with 6 additions and 26 deletions

View File

@@ -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