lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-iuh/+/15181


Change subject: iu_client: introduce a connection state
......................................................................

iu_client: introduce a connection state

When the SCCP stack indicate a disconnect, save this in the UE connection
to allow the application to free() the instance later.

Change-Id: I77e01724be05ac488a4685ba367b7a71985b54e3
---
M include/osmocom/ranap/iu_client.h
M src/iu_client.c
2 files changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/81/15181/1

diff --git a/include/osmocom/ranap/iu_client.h 
b/include/osmocom/ranap/iu_client.h
index 64ef9e4..4884f8a 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -23,6 +23,11 @@
        RANAP_NSAP_ADDR_ENC_V4RAW,
 };

+enum ranap_conn_state {
+       RANAP_CONN_STATE_CONNECTED,
+       RANAP_CONN_STATE_DISCONNECTED,
+};
+
 struct ranap_ue_conn_ctx {
        struct llist_head list;
        struct ranap_iu_rnc *rnc;
@@ -30,6 +35,7 @@
        int integrity_active;
        struct gprs_ra_id ra_id;
        enum ranap_nsap_addr_enc rab_assign_addr_enc;
+       enum ranap_conn_state conn_state;
 };

 enum ranap_iu_event_type {
diff --git a/src/iu_client.c b/src/iu_client.c
index 14247ff..0c8f08e 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -116,6 +116,7 @@

        ctx->rnc = rnc;
        ctx->conn_id = conn_id;
+       ctx->conn_state = RANAP_CONN_STATE_CONNECTED;
        llist_add(&ctx->list, &ue_conn_ctx_list);

        return ctx;
@@ -140,7 +141,8 @@
        if (!ue)
                return;

-       osmo_sccp_tx_disconn(g_scu, ue->conn_id, NULL, 0);
+       if (ue->conn_state == RANAP_CONN_STATE_CONNECTED)
+               osmo_sccp_tx_disconn(g_scu, ue->conn_id, NULL, 0);

        llist_for_each_entry(iter, &ue_conn_ctx_list, list) {
                if (iter == ue) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/15181
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I77e01724be05ac488a4685ba367b7a71985b54e3
Gerrit-Change-Number: 15181
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lyn...@fe80.eu>
Gerrit-MessageType: newchange

Reply via email to