forked from erlang/signerl
TCAP: make sure to start tcap_invocation_sup above tcap_ism_fsm
The tcap_invocation_sup is cretaed at the same time the tcap_cco_server is created. Once TR requests BEGIN components, the tcap_invocation_sup is requested to start a new tcap_ism_fsm child.
This commit is contained in:
parent
205f585435
commit
a0dd2c6228
|
@ -236,7 +236,7 @@ process_request_components([Head|Tail], State, AsnComps, ISMs) when
|
|||
invokeID = InvId} ->
|
||||
% if INVOKE component
|
||||
% start ISM and store ISM
|
||||
{ok, ISM} = tcap_ism_fsm:start_link(Usap, DialogueId,
|
||||
{ok, ISM} = tcap_invocation_sup:start_ism(Usap, DialogueId,
|
||||
InvId, Class, Tout),
|
||||
% signal 'operation-sent' to ISM
|
||||
gen_fsm:sent_event(ISM, 'operation-sent'),
|
||||
|
|
|
@ -46,10 +46,20 @@
|
|||
%% call backs needed for supervisor behaviour
|
||||
-export([init/1]).
|
||||
|
||||
init([USAP, ID]) ->
|
||||
gen_cco_child(USAP, ID) ->
|
||||
Name = list_to_atom("tcap_cco_" ++ integer_to_list(ID)),
|
||||
StartArgs = [{local, Name}, tcap_cco_server, [self(), USAP, ID], [{debug, [trace]}]],
|
||||
StartFunc = {gen_server, start_link, StartArgs},
|
||||
ChildSpec = {cco, StartFunc, temporary, 4000, worker, [tcap_cco_server]},
|
||||
{ok,{{one_for_all, 0, 1}, [ChildSpec]}}.
|
||||
{cco, StartFunc, permanent, 4000, worker, [tcap_cco_server]}.
|
||||
|
||||
gen_inv_sup_child(ID) ->
|
||||
StartFunc = {tcap_invocation_sup, start_link, [ID]},
|
||||
{invocation_sup, StartFunc, permanent, 4000, supervisor, [tcap_invocation_sup]}.
|
||||
|
||||
init([USAP, ID]) ->
|
||||
% start the CCO server as well as a (childless) invocation supervisor
|
||||
InvSup = gen_inv_sup_child(ID),
|
||||
Cco = gen_cco_child(USAP, ID),
|
||||
io:format("~p~n", [InvSup]),
|
||||
{ok,{{one_for_all, 0, 1}, [InvSup, Cco]}}.
|
||||
|
||||
|
|
|
@ -46,10 +46,20 @@
|
|||
%% call backs needed for supervisor behaviour
|
||||
-export([init/1]).
|
||||
|
||||
init([USAP, DlgId, InvokeID, OpClass, Timeout]) ->
|
||||
%% API to other modules
|
||||
-export([start_ism/1, start_link/1]).
|
||||
|
||||
init([]) ->
|
||||
{ok,{{one_for_all, 0, 1}, []}}.
|
||||
|
||||
start_ism([USAP, DlgId, InvokeID, OpClass, Timeout]) ->
|
||||
SupRef = list_to_atom("tcap_invocation_sup_" ++ integer_to_list(DlgId)),
|
||||
StartArgs = [USAP, DlgId, InvokeID, OpClass, Timeout],
|
||||
StartFunc = {tcap_ism_fsm, start_link, StartArgs},
|
||||
ChildSpec = {ism, StartFunc, temporary, 4000, worker,
|
||||
[tcap_ism_sup]},
|
||||
{ok,{{one_for_all, 0, 1}, [ChildSpec]}}.
|
||||
supervisor:start_child(SupRef, ChildSpec).
|
||||
|
||||
start_link(ID) ->
|
||||
Name = list_to_atom("tcap_invocation_sup_" ++ integer_to_list(ID)),
|
||||
supervisor:start_link({local, Name}, ?MODULE, []).
|
||||
|
|
Loading…
Reference in New Issue