On Thu, 23 Jul 2015 23:11:33 +0200, Sönke Ludwig wrote:

Am 23.07.2015 um 20:33 schrieb Lemonfiend:

class SomeWebInterface
{
     void get()
     {
         ...
         runTask(toDelegate(&someTask));
         ...
     }

     private auto someTask()
     {
         ...
         mySessionVar = "hello";
         ...
     }
}

Is there any way to have someTask set a SessionVar?

Since the request that determines the active session is bound to the
task that runs the request handler, this won't work using SessionVar -
it's basically implicitly a TaskLocal. But you could pass the
Session to the task and set the session field manually.

For that, the get method would have to have a HTTPServerRequest req
parameter and then pass req.session as an argument to runTask, which
forwards it to someTask.

Ah, so SessionVars are simply a convenience for accessing req.session.get/set? I never made the connection.. that makes a lot of sense :)
Thanks.