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:
Harald Welte 2011-12-17 17:47:41 +01:00
parent 205f585435
commit a0dd2c6228
3 changed files with 26 additions and 6 deletions

View File

@ -236,7 +236,7 @@ process_request_components([Head|Tail], State, AsnComps, ISMs) when
invokeID = InvId} -> invokeID = InvId} ->
% if INVOKE component % if INVOKE component
% start ISM and store ISM % 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), InvId, Class, Tout),
% signal 'operation-sent' to ISM % signal 'operation-sent' to ISM
gen_fsm:sent_event(ISM, 'operation-sent'), gen_fsm:sent_event(ISM, 'operation-sent'),

View File

@ -46,10 +46,20 @@
%% call backs needed for supervisor behaviour %% call backs needed for supervisor behaviour
-export([init/1]). -export([init/1]).
init([USAP, ID]) -> gen_cco_child(USAP, ID) ->
Name = list_to_atom("tcap_cco_" ++ integer_to_list(ID)), Name = list_to_atom("tcap_cco_" ++ integer_to_list(ID)),
StartArgs = [{local, Name}, tcap_cco_server, [self(), USAP, ID], [{debug, [trace]}]], StartArgs = [{local, Name}, tcap_cco_server, [self(), USAP, ID], [{debug, [trace]}]],
StartFunc = {gen_server, start_link, StartArgs}, StartFunc = {gen_server, start_link, StartArgs},
ChildSpec = {cco, StartFunc, temporary, 4000, worker, [tcap_cco_server]}, {cco, StartFunc, permanent, 4000, worker, [tcap_cco_server]}.
{ok,{{one_for_all, 0, 1}, [ChildSpec]}}.
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]}}.

View File

@ -46,10 +46,20 @@
%% call backs needed for supervisor behaviour %% call backs needed for supervisor behaviour
-export([init/1]). -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], StartArgs = [USAP, DlgId, InvokeID, OpClass, Timeout],
StartFunc = {tcap_ism_fsm, start_link, StartArgs}, StartFunc = {tcap_ism_fsm, start_link, StartArgs},
ChildSpec = {ism, StartFunc, temporary, 4000, worker, ChildSpec = {ism, StartFunc, temporary, 4000, worker,
[tcap_ism_sup]}, [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, []).