Change in osmo-sgsn[master]: gbproxy: add number-of-peers ctrl command

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Nov 22 17:32:21 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11895 )

Change subject: gbproxy: add number-of-peers ctrl command
......................................................................

gbproxy: add number-of-peers ctrl command

Return number of BTS peers. This is especially useful when no peers are
available because "gbproxy-state" command returns empty sstring in this
case.

Change-Id: I29b0664e60f7c81c3c7b495c1c8f2700e3f7e033
Related: SYS#2655
---
M src/gprs/gb_proxy_ctrl.c
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/gprs/gb_proxy_ctrl.c b/src/gprs/gb_proxy_ctrl.c
index 694a2f7..829d6f6 100644
--- a/src/gprs/gb_proxy_ctrl.c
+++ b/src/gprs/gb_proxy_ctrl.c
@@ -76,10 +76,23 @@
 
 CTRL_CMD_DEFINE_RO(gbproxy_state, "gbproxy-state");
 
+static int get_num_peers(struct ctrl_cmd *cmd, void *data)
+{
+	struct gbproxy_config *cfg = data;
+
+	cmd->reply = talloc_strdup(cmd, "");
+	cmd->reply = talloc_asprintf_append(cmd->reply, "%u", llist_count(&cfg->bts_peers));
+
+	return CTRL_CMD_REPLY;
+}
+CTRL_CMD_DEFINE_RO(num_peers, "number-of-peers");
+
 int gb_ctrl_cmds_install(void)
 {
 	int rc = 0;
 	rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_nsvc_state);
 	rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_gbproxy_state);
+	rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_num_peers);
+
 	return rc;
 }

-- 
To view, visit https://gerrit.osmocom.org/11895
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I29b0664e60f7c81c3c7b495c1c8f2700e3f7e033
Gerrit-Change-Number: 11895
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181122/e6b9d7ba/attachment.htm>


More information about the gerrit-log mailing list