fixeria submitted this change.
sctp_proxy: use lists:filter/2 in sctp_send_pending/2
Use less code to achieve the same result.
Change-Id: Ic666fd77bc6d04341f3c57140dea5d4a5e616e80
---
M src/sctp_proxy.erl
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/sctp_proxy.erl b/src/sctp_proxy.erl
index 5e0d26e..2866fcd 100644
--- a/src/sctp_proxy.erl
+++ b/src/sctp_proxy.erl
@@ -303,15 +303,9 @@
%% Send pending messages to the MME
-spec sctp_send_pending(state()) -> state().
sctp_send_pending(#state{tx_queue = Pending} = S) ->
- sctp_send_pending(lists:reverse(Pending), S).
-
--spec sctp_send_pending([binary()], state()) -> state().
-sctp_send_pending([Data | Pending], S) ->
- sctp_send_from_enb(Data, S),
- s1gw_metrics:gauge_dec(?S1GW_GAUGE_S1AP_PROXY_UPLINK_PACKETS_QUEUED),
- sctp_send_pending(Pending, S);
-
-sctp_send_pending([], S) ->
+ [] = lists:filter(fun(Data) -> sctp_send_from_enb(Data, S) =/= ok end,
+ lists:reverse(Pending)),
+ s1gw_metrics:gauge_set(?S1GW_GAUGE_S1AP_PROXY_UPLINK_PACKETS_QUEUED, 0),
S#state{tx_queue = []}.
To view, visit change 41616. To unsubscribe, or for help writing mail filters, visit settings.