summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-05-09 00:02:59 +0200
committerHarald Welte <laforge@gnumonks.org>2012-05-09 00:03:38 +0200
commit312a1eb1aeed8a2ab7ec202e74a3fa4d5f273228 (patch)
treef589f523779414a9ed37feaec5eaaab5dfb8f4ca
parenteb61885c358100e0e2d73be96f9f83d96422bc3d (diff)
xua_as_fsm: ignore ASP_DOWN in AS-PENDING and fix state list generation
-rw-r--r--src/xua_as_fsm.erl6
-rw-r--r--src/xua_asp_fsm.erl15
2 files changed, 18 insertions, 3 deletions
diff --git a/src/xua_as_fsm.erl b/src/xua_as_fsm.erl
index 6421cce..9380f8e 100644
--- a/src/xua_as_fsm.erl
+++ b/src/xua_as_fsm.erl
@@ -197,6 +197,9 @@ as_pending(#primitive{subsystem = 'ASPAS', gen_name = 'ASP_INACTIVE',
% FIXME: do we need to re-check as_pending state if we get ASP_DOWN of the last
% inactive ASP ?
+as_pending(#primitive{subsystem = 'ASPAS', gen_name = 'ASP_DOWN',
+ spec_name = indication, parameters = _Params}, LoopDat) ->
+ next_state(as_pending, LoopDat);
as_pending({timer_expired, t_r}, LoopDat) ->
% check if there is at least one ASP in ASP-INACTIVE -> AS-INACTIVE
@@ -240,5 +243,4 @@ check_any_other_asp_in_state(State, LoopDat, AspPid) ->
lists:member(State, StateList).
build_asp_state_list(ListOfPids) ->
- % FIXME
- [].
+ [xua_asp_fsm:get_state(X) || X <- ListOfPids].
diff --git a/src/xua_asp_fsm.erl b/src/xua_asp_fsm.erl
index 50845f6..f15fe24 100644
--- a/src/xua_asp_fsm.erl
+++ b/src/xua_asp_fsm.erl
@@ -39,7 +39,8 @@
-include("m3ua.hrl").
% gen_fsm exports
--export([init/1, terminate/3, code_change/4, handle_event/3, handle_info/3]).
+-export([init/1, terminate/3, code_change/4, handle_event/3, handle_info/3,
+ handle_sync_event/4]).
% states in this FSM
-export([asp_down/2, asp_inactive/2, asp_active/2]).
@@ -47,6 +48,9 @@
% helper functions exporte to callback modules
-export([send_sctp_to_peer/2, send_prim_to_user/2]).
+% global exports
+-export([get_state/1]).
+
-export([behaviour_info/1]).
behaviour_info(callbacks) ->
@@ -98,6 +102,15 @@ handle_info(Info, State, LoopDat) ->
io:format("Unknown Info ~p in state ~p~n", [Info, State]),
{next_state, State, LoopDat}.
+handle_sync_event(get_state, _From, StateName, LoopDat) ->
+ {reply, state2aspas(StateName), StateName, LoopDat}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% exports
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+get_state(Pid) ->
+ gen_fsm:sync_send_all_state_event(Pid, get_state).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STATE "asp_down"