aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-04-13 19:56:10 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-04-14 17:45:12 +0200
commit7fcd33df8cdaddbb171deed698bd881ebe0b48c9 (patch)
treead3d780a7c725e45d28ac49a166939086e04341e
parent68a796ebc51070c299a3dc310059b3c8bcd1344f (diff)
ranap_iu_tx_release_free(): always trigger RANAP_IU_EVENT_IU_RELEASE as a resultHEADmaster
This allows the SGSN always having feedback on the resolution of the release, hence being able to stay in PMM CONNECTED state until the resolution is received, then moving to PMM IDLE. Related: SYS#5389 Change-Id: Iac822c74e56750dc40e94573eae0e20853ff68c0
-rw-r--r--include/osmocom/ranap/iu_client.h6
-rw-r--r--src/iu_client.c15
2 files changed, 13 insertions, 8 deletions
diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h
index 24a5af9..2e72839 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -75,9 +75,9 @@ int ranap_iu_tx_sec_mode_cmd(struct ranap_ue_conn_ctx *uectx, struct osmo_auth_v
int ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *ue_ctx, const char *imsi);
int ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
-/* transmit a Iu Release Command and free the ctx afterwards.
- * If a Release Complete is not received within timeout s,
- * release the SCCP connection. */
+/* Transmit a Iu Release Command and submit event RANAP_IU_EVENT_IU_RELEASE upon
+ * Release Complete or timeout. Caller is responsible to free the context and
+ * closing the SCCP connection (ranap_iu_free_ue) upon recieval of the event. */
void ranap_iu_tx_release_free(struct ranap_ue_conn_ctx *ctx,
const struct RANAP_Cause *cause,
int timeout);
diff --git a/src/iu_client.c b/src/iu_client.c
index 06285ec..da433da 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -124,6 +124,12 @@ static int global_iu_event(struct ranap_ue_conn_ctx *ue_ctx,
return global_iu_event_cb(ue_ctx, type, data);
}
+static void ue_conn_ctx_release_timeout_cb(void *ctx_)
+{
+ struct ranap_ue_conn_ctx *ctx = (struct ranap_ue_conn_ctx *)ctx_;
+ global_iu_event(ctx, RANAP_IU_EVENT_IU_RELEASE, NULL);
+}
+
static struct ranap_ue_conn_ctx *ue_conn_ctx_alloc(struct ranap_iu_rnc *rnc, uint32_t conn_id)
{
struct ranap_ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ranap_ue_conn_ctx);
@@ -133,7 +139,7 @@ static struct ranap_ue_conn_ctx *ue_conn_ctx_alloc(struct ranap_iu_rnc *rnc, uin
ctx->notification = true;
ctx->free_on_release = false;
osmo_timer_setup(&ctx->release_timeout,
- (void *)(void *) ranap_iu_free_ue,
+ ue_conn_ctx_release_timeout_cb,
ctx);
llist_add(&ctx->list, &ue_conn_ctx_list);
@@ -501,10 +507,9 @@ void ranap_iu_tx_release_free(struct ranap_ue_conn_ctx *ctx,
ctx->notification = false;
ctx->free_on_release = true;
int ret = ranap_iu_tx_release(ctx, cause);
- if (ret) {
- ranap_iu_free_ue(ctx);
- return;
- }
+ /* On Tx failure, trigger timeout immediately, as the response will never arrive */
+ if (ret)
+ timeout = 0;
osmo_timer_schedule(&ctx->release_timeout, timeout, 0);
}