Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handle of timeout in map_reply_ie/1 #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions apps/ergw_core/src/ergw_context.erl
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ port_message_h(Request, #gtp{} = Msg) ->
port_message_run(Request, Msg)
catch
throw:{error, Error} ->
?LOG(error, "handler failed with: ~p", [Error]),
gtp_context:generic_error(Request, Msg, Error)
Reason = handle_jobs_reason(Error),
?LOG(error, "handler failed with: ~p", [Reason]),
gtp_context:generic_error(Request, Msg, Reason)
after
jobs:done(Opaque)
end;
{error, Reason} ->
gtp_context:generic_error(Request, Msg, Reason)
gtp_context:generic_error(Request, Msg, handle_jobs_reason(Reason))
end.

port_message_run(Request, #gtp{type = g_pdu} = Msg) ->
Expand Down Expand Up @@ -139,3 +140,10 @@ load_class(#gtp{version = v1} = Msg) ->
gtp_v1_c:load_class(Msg);
load_class(#gtp{version = v2} = Msg) ->
gtp_v2_c:load_class(Msg).

handle_jobs_reason(rejected = Reason) ->
Reason;
handle_jobs_reason(timeout) ->
rate_limit;
handle_jobs_reason(Reason) ->
Reason.
2 changes: 1 addition & 1 deletion apps/ergw_core/src/gtp_v1_c.erl
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ map_reply_ie(missing_or_unknown_apn) ->
#cause{value = missing_or_unknown_apn};
map_reply_ie(no_resources_available) ->
#cause{value = no_resources_available};
map_reply_ie(rejected) ->
map_reply_ie(Reason) when Reason =:= rejected; Reason =:= rate_limit ->
#cause{value = no_resources_available};
map_reply_ie(all_dynamic_addresses_are_occupied) ->
#cause{value = all_dynamic_pdp_addresses_are_occupied};
Expand Down
2 changes: 1 addition & 1 deletion apps/ergw_core/src/gtp_v2_c.erl
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ map_reply_ie(missing_or_unknown_apn) ->
#v2_cause{v2_cause = missing_or_unknown_apn};
map_reply_ie(no_resources_available) ->
#v2_cause{v2_cause = no_resources_available};
map_reply_ie(rejected) ->
map_reply_ie(Reason) when Reason =:= rejected; Reason =:= rate_limit ->
#v2_cause{v2_cause = no_resources_available};
map_reply_ie(all_dynamic_addresses_are_occupied) ->
#v2_cause{v2_cause = all_dynamic_addresses_are_occupied};
Expand Down