summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-05-08 23:36:49 +0200
committerHarald Welte <laforge@gnumonks.org>2012-05-08 23:36:49 +0200
commit7c3ec176b13b4011ae6f96c141a24dadad84a055 (patch)
tree8d625ce69570b10b9af5f27476d5fc01687a5f98
parentee7964c0f3356a1c6ffa7dd826e3cd08e369d469 (diff)
xua_as_fsm: fix use of lists:all/2 and introduc create_asp/2
-rw-r--r--src/xua_as_fsm.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xua_as_fsm.erl b/src/xua_as_fsm.erl
index 0b04f76..6421cce 100644
--- a/src/xua_as_fsm.erl
+++ b/src/xua_as_fsm.erl
@@ -44,6 +44,9 @@
% states in this FSM
-export([as_down/2, as_inactive/2, as_active/2, as_pending/2]).
+% exported API
+-export([create_asp/2]).
+
% Timeouts in milliseconds
-define(T_R_TIMEOUT, 2*60*100).
@@ -54,6 +57,10 @@
asp_list
}).
+create_asp(Name, AspFsmArgs) ->
+ AsFsmName = sg_as_sup:get_as_fsm_name(Name),
+ gen_fsm:sync_send_all_state_event(AsFsmName, {create_asp, AspFsmArgs}).
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gen_fsm callbacks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -225,7 +232,7 @@ check_any_other_asp_in_active(LoopDat, AspPid) ->
check_any_other_asp_not_down(LoopDat, AspPid) ->
ListWithoutMe = lists:delete(AspPid, LoopDat#as_state.asp_list),
StateList = build_asp_state_list(ListWithoutMe),
- not lists:all('ASP_DOWN', StateList).
+ not lists:all(fun(E) -> E == 'ASP_DOWN' end, StateList).
check_any_other_asp_in_state(State, LoopDat, AspPid) ->
ListWithoutMe = lists:delete(AspPid, LoopDat#as_state.asp_list),