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 usingSessionVar-
it's basically implicitly aTaskLocal. But you could pass theSessionto the task and set the session field manually.For that, the
getmethod would have to have aHTTPServerRequest req
parameter and then passreq.sessionas an argument torunTask, which
forwards it tosomeTask.
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.
