[PATCH] osmo-mgw[master]: vty: simplify endpoint allocation

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Nov 14 16:02:52 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4775

to look at the new patch set (#2).

vty: simplify endpoint allocation

mgcp_parse_config() uses a helper function allocate_trunk() to
perform the trunk allocation. This helper function only calls
mgcp_endpoints_allocate() and checks the return code.

Call mgcp_endpoints_allocate() directly from mgcp_parse_config()

Change-Id: Iefdc5b905d76d2cd97f26584261fe5cbefb699cf
---
M src/libosmo-mgcp/mgcp_vty.c
1 file changed, 6 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/75/4775/2

diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 06420dd..9420d96 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -1269,18 +1269,6 @@
 	return 0;
 }
 
-static int allocate_trunk(struct mgcp_trunk_config *trunk)
-{
-	if (mgcp_endpoints_allocate(trunk) != 0) {
-		LOGP(DLMGCP, LOGL_ERROR,
-		     "Failed to allocate %d endpoints on trunk %d.\n",
-		     trunk->number_endpoints, trunk->trunk_nr);
-		return -1;
-	}
-
-	return 0;
-}
-
 int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
 		      enum mgcp_role role)
 {
@@ -1304,17 +1292,18 @@
 		return -1;
 	}
 
-	if (allocate_trunk(&g_cfg->trunk) != 0) {
+	if (mgcp_endpoints_allocate(&g_cfg->trunk) != 0) {
 		LOGP(DLMGCP, LOGL_ERROR,
-		     "Failed to initialize the virtual trunk.\n");
+		     "Failed to initialize the virtual trunk (%d endpoints)\n",
+		     g_cfg->trunk.number_endpoints);
 		return -1;
 	}
 
 	llist_for_each_entry(trunk, &g_cfg->trunks, entry) {
-		if (allocate_trunk(trunk) != 0) {
+		if (mgcp_endpoints_allocate(trunk) != 0) {
 			LOGP(DLMGCP, LOGL_ERROR,
-			     "Failed to initialize E1 trunk %d.\n",
-			     trunk->trunk_nr);
+			     "Failed to initialize trunk %d (%d endpoints)\n",
+			     trunk->trunk_nr, trunk->number_endpoints);
 			return -1;
 		}
 	}

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iefdc5b905d76d2cd97f26584261fe5cbefb699cf
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list