forked from erlang/signerl
rename ets 'transaction' table to 'tcap_transaction'
the ets namespace is global, so weshould prefix it with the name tcap to avoid collisions with other applications.
This commit is contained in:
parent
9d04bb6e40
commit
fb5de0e5cc
|
@ -233,4 +233,4 @@ code_change(_, _, _) -> ok.
|
|||
|
||||
%% get the next originating transaction id from the global counter
|
||||
new_transaction_id() ->
|
||||
ets:update_counter(tcap, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
ets:update_counter(tcap_transaction, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
|
|
|
@ -174,7 +174,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParms}, State)
|
|||
case 'TR':decode('Continue', TPDU) of
|
||||
{ok, Continue} ->
|
||||
%% DTID assigned?
|
||||
case catch ets:lookup_element(transaction, TPDU#'Continue'.dtid, 2) of
|
||||
case catch ets:lookup_element(tcap_transaction, TPDU#'Continue'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-CONTINUE",
|
||||
{dtid, TPDU#'End'.dtid}, {nsap, State#state.nsap},
|
||||
|
@ -210,7 +210,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParms}, State)
|
|||
case 'TR':decode('End', TPDU) of
|
||||
{ok, End} ->
|
||||
%% DTID assigned?
|
||||
case catch ets:lookup(transaction, TPDU#'End'.dtid, 2) of
|
||||
case catch ets:lookup(tcap_transaction, TPDU#'End'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-END",
|
||||
{dtid, TPDU#'End'.dtid}, {nsap, State#state.nsap},
|
||||
|
@ -240,7 +240,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParms}, State)
|
|||
case 'TR':decode('Abort', TPDU) of
|
||||
{ok, Abort} ->
|
||||
%% DTID assigned?
|
||||
case catch ets:lookup(transaction, TPDU#'Abort'.dtid, 2) of
|
||||
case catch ets:lookup(tcap_transaction, TPDU#'Abort'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-ABORT",
|
||||
{dtid, TPDU#'Abort'.dtid}, {nsap, State#state.nsap},
|
||||
|
@ -348,19 +348,19 @@ handle_cast({'TR', 'BEGIN', request, BeginParms}, State)
|
|||
handle_cast({'TR', 'CONTINUE', request, ContParms}, State)
|
||||
when is_record(ContParms, 'TR-CONTINUE') ->
|
||||
TransactionID = ContParms#'TR-CONTINUE'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'CONTINUE', transaction, ContParms}),
|
||||
{noreply, State};
|
||||
handle_cast({'TR', 'END', request, EndParms}, State)
|
||||
when is_record(EndParms, 'TR-END') ->
|
||||
TransactionID = EndParms#'TR-END'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'END', transaction, EndParms}),
|
||||
{noreply, State};
|
||||
handle_cast({'TR', 'U-ABORT', request, AbortParms}, State)
|
||||
when is_record(AbortParms, 'TR-U-ABORT') ->
|
||||
TransactionID = AbortParms#'TR-U-ABORT'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'ABORT', transaction, AbortParms}),
|
||||
{noreply, State};
|
||||
|
||||
|
@ -405,5 +405,5 @@ code_change(_, _, _) -> ok.
|
|||
%%
|
||||
%% reference: Figure A.3 bis/Q.774
|
||||
new_tid() ->
|
||||
ets:update_counter(transaction, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
ets:update_counter(tcap_transaction, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
%% initialize the server
|
||||
init({NSAP, USAP, TID, Supervisor, SupRef, TCO}) ->
|
||||
%% store our process identifier in the global transaction ID table
|
||||
ets:insert(transaction, {TID, self()}),
|
||||
ets:insert(tcap_transaction, {TID, self()}),
|
||||
process_flag(trap_exit, true),
|
||||
{ok, idle, #state{nsap = NSAP, usap = USAP, localTID = TID, supervisor = Supervisor,
|
||||
supref = SupRef, tco = TCO}}.
|
||||
|
@ -419,7 +419,7 @@ handle_info(Info, StateName, State) ->
|
|||
|
||||
%% handle a shutdown request
|
||||
terminate(_Reason, _StateName, State) ->
|
||||
ets:delete(transaction, State#state.localTID),
|
||||
ets:delete(tcap_transaction, State#state.localTID),
|
||||
%% signal TCO that we are stopping
|
||||
gen_server:cast(State#state.supervisor, {'tsm-stopped', State#state.supref}).
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
|
|||
case 'TR':decode('Continue', TPDU) of
|
||||
{ok, Continue} ->
|
||||
% DTID assigned?
|
||||
case catch ets:lookup_element(transaction, TPDU#'Continue'.dtid, 2) of
|
||||
case catch ets:lookup_element(tcap_transaction, TPDU#'Continue'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-CONTINUE",
|
||||
{dtid, TPDU#'End'.dtid},
|
||||
|
@ -371,7 +371,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
|
|||
case 'TR':decode('End', TPDU) of
|
||||
{ok, End} ->
|
||||
% DTID assigned?
|
||||
case catch ets:lookup(transaction, TPDU#'End'.dtid, 2) of
|
||||
case catch ets:lookup(tcap_transaction, TPDU#'End'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-END",
|
||||
{dtid, TPDU#'End'.dtid},
|
||||
|
@ -401,7 +401,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
|
|||
case 'TR':decode('Abort', TPDU) of
|
||||
{ok, Abort} ->
|
||||
% DTID assigned?
|
||||
case catch ets:lookup(transaction, TPDU#'Abort'.dtid, 2) of
|
||||
case catch ets:lookup(tcap_transaction, TPDU#'Abort'.dtid, 2) of
|
||||
{error, _Reason} ->
|
||||
error_logger:error_report(["DTID not found in received N-ABORT",
|
||||
{dtid, TPDU#'Abort'.dtid},
|
||||
|
@ -518,19 +518,19 @@ handle_cast({'TR', 'BEGIN', request, BeginParams}, State)
|
|||
handle_cast({'TR', 'CONTINUE', request, ContParams}, State)
|
||||
when is_record(ContParams, 'TR-CONTINUE') ->
|
||||
TransactionID = ContParams#'TR-CONTINUE'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'CONTINUE', transaction, ContParams}),
|
||||
{noreply, State};
|
||||
handle_cast({'TR', 'END', request, EndParams}, State)
|
||||
when is_record(EndParams, 'TR-END') ->
|
||||
TransactionID = EndParams#'TR-END'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'END', transaction, EndParams}),
|
||||
{noreply, State};
|
||||
handle_cast({'TR', 'U-ABORT', request, AbortParams}, State)
|
||||
when is_record(AbortParams, 'TR-U-ABORT') ->
|
||||
TransactionID = AbortParams#'TR-U-ABORT'.transactionID,
|
||||
TSM = ets:lookup_element(transaction, TransactionID, 2),
|
||||
TSM = ets:lookup_element(tcap_transaction, TransactionID, 2),
|
||||
gen_fsm:send_event(TSM, {'ABORT', transaction, AbortParams}),
|
||||
{noreply, State};
|
||||
|
||||
|
@ -624,7 +624,7 @@ code_change(OldVersion, statename, State, Extra) ->
|
|||
%%
|
||||
%% reference: Figure A.3 bis/Q.774
|
||||
new_tid() ->
|
||||
ets:update_counter(transaction, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
ets:update_counter(tcap_transaction, transactionID, {2, 1, 16#ffffffff, 0}).
|
||||
|
||||
get_start(dialogue, DialogueID, State) ->
|
||||
Module = State#state.module,
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
%% initialize the server
|
||||
init({NSAP, USAP, TID, Supervisor, SupRef, TCO}) ->
|
||||
%% store our process identifier in the global transaction ID table
|
||||
ets:insert(transaction, {TID, self()}),
|
||||
ets:insert(tcap_transaction, {TID, self()}),
|
||||
process_flag(trap_exit, true),
|
||||
{ok, idle, #state{nsap = NSAP, usap = USAP, localTID = TID, supervisor = Supervisor,
|
||||
supref = SupRef, tco = TCO}}.
|
||||
|
@ -418,7 +418,7 @@ handle_info(Info, StateName, State) ->
|
|||
|
||||
%% handle a shutdown request
|
||||
terminate(_Reason, _StateName, State) ->
|
||||
ets:delete(transaction, State#state.localTID),
|
||||
ets:delete(tcap_transaction, State#state.localTID),
|
||||
%% signal TCO that we are stopping
|
||||
gen_server:cast(State#state.supervisor, {'tsm-stopped', State#state.supref}).
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
%% @equiv //kernel/application:start/3
|
||||
%%
|
||||
start(normal, StartArgs) ->
|
||||
ets:new(transaction, [named_table, public]),
|
||||
ets:new(tcap_transaction, [named_table, public]),
|
||||
ets:new(tcap_dha, [named_table, public]),
|
||||
{ok, SupRef} = application:get_env(supref),
|
||||
supervisor:start_link(SupRef, tcap_sup, StartArgs).
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
%%
|
||||
init(_StartArgs) ->
|
||||
StartMod = tcap_sap_sup,
|
||||
StartFunc = {supervisor, start_link, [StartMod]},
|
||||
ChildSpec = {sap_sup, StartFunc, permanent, infinity, supervisor, [StartMod]},
|
||||
StartFunc = {supervisor, start_link, [StartMod,[osmo_sccp_tcap,[6],[]]]},
|
||||
% {Id, StartFunc, Restart, Shutdown, Tpype, Modules}
|
||||
ChildSpec = {tcap_sap_sup, StartFunc, permanent, infinity, supervisor, [StartMod]},
|
||||
{ok,{{simple_one_for_one, 10, 60}, [ChildSpec]}}.
|
||||
|
|
Loading…
Reference in New Issue