[PATCH] osmo-bsc[master]: osmo_bsc_mgcp: cosmetic: introduce mgcp_init(), soak up fsm ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Jan 19 03:03:35 UTC 2018


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

osmo_bsc_mgcp: cosmetic: introduce mgcp_init(), soak up fsm init

A subsequent patch will add registration of a signal; cosmetically prepare by
creating a common mgcp_init() function. It makes sense for the FSM registration
to move to it.

Change-Id: I510e1081171706eb3d9fb2db50a9aa4f768929b5
---
M include/osmocom/bsc/osmo_bsc_mgcp.h
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/osmo_bsc_mgcp.c
3 files changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/90/5890/1

diff --git a/include/osmocom/bsc/osmo_bsc_mgcp.h b/include/osmocom/bsc/osmo_bsc_mgcp.h
index 7452513..1e06331 100644
--- a/include/osmocom/bsc/osmo_bsc_mgcp.h
+++ b/include/osmocom/bsc/osmo_bsc_mgcp.h
@@ -52,6 +52,8 @@
 	mgcp_trans_id_t mgw_pending_trans;
 };
 
+void mgcp_init(struct gsm_network *net);
+
 struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp, struct osmo_bsc_sccp_con *conn,
 				  enum gsm48_chan_mode chan_mode, bool full_rate);
 void mgcp_clear_complete(struct mgcp_ctx *mgcp_ctx, struct msgb *resp);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index e4c8fc5..1555ac1 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -29,6 +29,7 @@
 #include <osmocom/bsc/ipaccess.h>
 #include <osmocom/bsc/ctrl.h>
 #include <osmocom/bsc/osmo_bsc_sigtran.h>
+#include <osmocom/bsc/osmo_bsc_mgcp.h>
 
 #include <osmocom/ctrl/control_cmd.h>
 #include <osmocom/ctrl/control_if.h>
@@ -293,6 +294,8 @@
 		exit(1);
 	}
 
+	mgcp_init(bsc_gsmnet);
+
 	signal(SIGINT, &signal_handler);
 	signal(SIGTERM, &signal_handler);
 	signal(SIGABRT, &signal_handler);
diff --git a/src/osmo-bsc/osmo_bsc_mgcp.c b/src/osmo-bsc/osmo_bsc_mgcp.c
index 186c8c5..519eaf4 100644
--- a/src/osmo-bsc/osmo_bsc_mgcp.c
+++ b/src/osmo-bsc/osmo_bsc_mgcp.c
@@ -964,18 +964,11 @@
 {
 	struct mgcp_ctx *mgcp_ctx;
 	char name[32];
-	static bool fsm_registered = false;
 
 	OSMO_ASSERT(mgcp);
 	OSMO_ASSERT(conn);
 
 	OSMO_ASSERT(snprintf(name, sizeof(name), "MGW_%i", conn->conn_id) < sizeof(name));
-
-	/* Register the fsm description (if not already done) */
-	if (fsm_registered == false) {
-		osmo_fsm_register(&fsm_bsc_mgcp);
-		fsm_registered = true;
-	}
 
 	/* Allocate and configure a new fsm instance */
 	mgcp_ctx = talloc_zero(ctx, struct mgcp_ctx);
@@ -1093,3 +1086,8 @@
 	osmo_fsm_inst_free(mgcp_ctx->fsm);
 	talloc_free(mgcp_ctx);
 }
+
+void mgcp_init(struct gsm_network *net)
+{
+	osmo_fsm_register(&fsm_bsc_mgcp);
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I510e1081171706eb3d9fb2db50a9aa4f768929b5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list