Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[feature] stdlib/session: new mixed context selector

  • Loading branch information...
commit 3bb3206eadf4b9e2002a2436d560f352fbb49389 1 parent 9d85f9c
François-Régis Sinot authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.