pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37923?usp=email )


Change subject: erab_fsm: Abort and reply call with error if unable to 
establish PFCP sess
......................................................................

erab_fsm: Abort and reply call with error if unable to establish PFCP sess

Change-Id: If23881205b995e76647289d5e6c1c85d02f93b47
---
M src/erab_fsm.erl
1 file changed, 9 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw 
refs/changes/23/37923/1

diff --git a/src/erab_fsm.erl b/src/erab_fsm.erl
index 544f5ab..91bfc64 100644
--- a/src/erab_fsm.erl
+++ b/src/erab_fsm.erl
@@ -170,11 +170,16 @@


 %% state SESSION_ESTABLISH :: PFCP session establishment
-session_establish(enter, OldState, S) ->
+session_establish(enter, OldState, #erab_state{from = From} = S) ->
     ?LOG_DEBUG("State change: ~p -> ~p", [OldState, ?FUNCTION_NAME]),
-    ok = session_establish_req(S),
-    {next_state, ?FUNCTION_NAME, S, %% loop transition to enable state_timeout
-     [{state_timeout, ?ERAB_T_SESSION_ESTABLISH, ?FUNCTION_NAME}]};
+    case session_establish_req(S) of
+        ok ->
+            {keep_state, S,
+             [{state_timeout, ?ERAB_T_SESSION_ESTABLISH, ?FUNCTION_NAME}]};
+        {error, Reason} -> {stop_and_reply,
+                            {shutdown, Reason},
+                            {reply, From, {error, {timeout, ?FUNCTION_NAME}}}}
+    end;

 session_establish(state_timeout, _Timeout,
                   #erab_state{from = From}) ->

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37923?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: If23881205b995e76647289d5e6c1c85d02f93b47
Gerrit-Change-Number: 37923
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to