Permalink
Browse files

[feature] stdlib/session: new mixed context selector

  • Loading branch information...
1 parent 9d85f9c commit 3bb3206eadf4b9e2002a2436d560f352fbb49389 François-Régis Sinot committed Sep 19, 2011
Showing with 8 additions and 0 deletions.
  1. +1 −0 stdlib/core/rpc/core/session.opa
  2. +7 −0 stdlib/core/rpc/core/session_private.opa
View
1 stdlib/core/rpc/core/session.opa
@@ -152,6 +152,7 @@ type Session.basic_instruction =
type Session.context_selector =
{maker} /* Takes the context of the creator of the session */
/ {sender} /* Takes the context of the sender of the message */
+ / {mixed} /* As maker, when the context at creation is set (client or sender), otherwise sender */
/**
* Type of sessions handlers.
View
7 stdlib/core/rpc/core/session_private.opa
@@ -124,6 +124,13 @@ type Session.how_send('message) =
match selector with
| { maker } -> { some = ThreadContext.get({current}) }
| { sender } -> { none }
+ | { mixed } ->
+ context = ThreadContext.get({current})
+ match context.key
+ | { nothing } -> { none }
+ | _ -> { some = context }
+ end
+ end
make(state, unser, handler, {none}, ctx, more, concurrent)
: channel('msg)

0 comments on commit 3bb3206

Please sign in to comment.