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


Change subject: sctp_proxy: make fetch_info/1 return a map
......................................................................

sctp_proxy: make fetch_info/1 return a map

Change-Id: I24029faa7e44efe34599b46fae731c801ff6191d
---
M src/sctp_proxy.erl
1 file changed, 18 insertions(+), 7 deletions(-)



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

diff --git a/src/sctp_proxy.erl b/src/sctp_proxy.erl
index b9258c3..830fe91 100644
--- a/src/sctp_proxy.erl
+++ b/src/sctp_proxy.erl
@@ -53,6 +53,18 @@

 -include("s1gw_metrics.hrl").

+
+-type conn_info() :: #{state := atom(),
+                       handler := pid(),
+                       mme_addr := inet:ip_address(),
+                       mme_port := inet:port_number(),
+                       enb_aid := gen_sctp:assoc_id(),
+                       mme_aid => gen_sctp:assoc_id()
+                      }.
+
+-export_type([conn_info/0]).
+
+
 %% ------------------------------------------------------------------
 %% public API
 %% ------------------------------------------------------------------
@@ -70,7 +82,7 @@
     gen_statem:cast(Pid, {send_data, Data}).


--spec fetch_info(pid()) -> proplists:proplist().
+-spec fetch_info(pid()) -> conn_info().
 fetch_info(Pid) ->
     gen_statem:call(Pid, ?FUNCTION_NAME).

@@ -207,12 +219,11 @@
 handle_event(State, {call, From}, fetch_info,
              #{handler := Pid, conn_cfg := ConnCfg} = S0) ->
     S1 = maps:with([enb_aid, mme_aid], S0),
-    S2 = S1#{state => State,
-             handler => Pid,
-             mme_addr => maps:get(raddr, ConnCfg),
-             mme_port => maps:get(rport, ConnCfg)},
-    Reply = proplists:from_map(S2),
-    {keep_state_and_data, {reply, From, Reply}};
+    Info = S1#{state => State,
+               handler => Pid,
+               mme_addr => maps:get(raddr, ConnCfg),
+               mme_port => maps:get(rport, ConnCfg)},
+    {keep_state_and_data, {reply, From, Info}};

 handle_event(State, {call, From}, EventData, _S) ->
     ?LOG_ERROR("Unexpected call in state ~p: ~p", [State, EventData]),

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40905?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: I24029faa7e44efe34599b46fae731c801ff6191d
Gerrit-Change-Number: 40905
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>

Reply via email to