[PATCH] osmo-msc[master]: a_reset: Add additional "a_reset_alloc" argument

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 8 23:18:33 UTC 2018


Review at  https://gerrit.osmocom.org/6325

a_reset: Add additional "a_reset_alloc" argument

Using this argument we can create the state machine in the
"already connected" state, i.e. without starting an outbound
RESET procedure.

Change-Id: Ibf569d57300965cd47084fa0bff54aa67679e2a1
---
M include/osmocom/msc/a_reset.h
M src/libcommon-cs/a_reset.c
M src/libmsc/a_iface.c
3 files changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/25/6325/1

diff --git a/include/osmocom/msc/a_reset.h b/include/osmocom/msc/a_reset.h
index 7aaab06..cdb17c2 100644
--- a/include/osmocom/msc/a_reset.h
+++ b/include/osmocom/msc/a_reset.h
@@ -45,7 +45,8 @@
 };
 
 /* Create and start state machine which handles the reset/reset-ack procedure */
-struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv);
+struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv,
+				  bool already_connected);
 
 /* Tear down state machine */
 void a_reset_free(struct a_reset_ctx *reset);
diff --git a/src/libcommon-cs/a_reset.c b/src/libcommon-cs/a_reset.c
index 072181d..25192c3 100644
--- a/src/libcommon-cs/a_reset.c
+++ b/src/libcommon-cs/a_reset.c
@@ -114,7 +114,8 @@
 };
 
 /* Create and start state machine which handles the reset/reset-ack procedure */
-struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv)
+struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv,
+				  bool already_connected)
 {
 	OSMO_ASSERT(name);
 
@@ -134,8 +135,13 @@
 	OSMO_ASSERT(reset->fsm);
 	reset->fsm->priv = reset;
 
-	/* kick off reset-ack sending mechanism */
-	osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
+	if (already_connected)
+		osmo_fsm_inst_state_chg(reset->fsm, ST_CONN, 0, 0);
+	else {
+		/* kick off reset-ack sending mechanism */
+		osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL,
+					RESET_RESEND_TIMER_NO);
+	}
 
 	return reset;
 }
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 11e1542..16df46d 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -481,7 +481,7 @@
 
 	/* Start reset procedure to make the new connection active */
 	snprintf(bsc_name, sizeof(bsc_name), "bsc-%i", bsc_addr->pc);
-	bsc_ctx->reset = a_reset_alloc(bsc_ctx, bsc_name, a_reset_cb, bsc_ctx);
+	bsc_ctx->reset = a_reset_alloc(bsc_ctx, bsc_name, a_reset_cb, bsc_ctx, false);
 }
 
 /* Callback function, called by the SSCP stack when data arrives */

-- 
To view, visit https://gerrit.osmocom.org/6325
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf569d57300965cd47084fa0bff54aa67679e2a1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list