pespin has submitted this change. ( 
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, 10 insertions(+), 4 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/erab_fsm.erl b/src/erab_fsm.erl
index 544f5ab..ae17a6e 100644
--- a/src/erab_fsm.erl
+++ b/src/erab_fsm.erl
@@ -170,11 +170,17 @@


 %% 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 ->
+            {next_state, ?FUNCTION_NAME, S, %% loop transition to enable 
state_timeout
+             [{state_timeout, ?ERAB_T_SESSION_ESTABLISH, ?FUNCTION_NAME}]};
+        {error, Reason} ->
+            {stop_and_reply,
+             {shutdown, Reason},
+             {reply, From, {error, Reason}}}
+    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: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: If23881205b995e76647289d5e6c1c85d02f93b47
Gerrit-Change-Number: 37923
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to