Change in ...osmo-sgsn[master]: gtp: make echo_interval unsigned

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

laforge gerrit-no-reply at lists.osmocom.org
Fri Aug 30 08:22:22 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/15304 )

Change subject: gtp: make echo_interval unsigned
......................................................................

gtp: make echo_interval unsigned

There's no real need to use -1 to indicate echo timer as disabled, since
0 can also be used (it doesn't make sense to have a timer timeout of 0).
This way code is simplified.

Change-Id: I689034887188a53590eddeffda781629694eb5ed
---
M include/osmocom/sgsn/gprs_sgsn.h
M src/gprs/gprs_sgsn.c
M src/gprs/sgsn_vty.c
3 files changed, 5 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, approved



diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 336155c..48c063d 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -392,7 +392,7 @@
 	struct gsn_t *gsn;
 	struct llist_head pdp_list;	/* list of associated pdp ctx (struct sgsn_pdp_ctx*) */
 	struct osmo_timer_list echo_timer;
-	int echo_interval;
+	unsigned int echo_interval;
 };
 struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id);
 void sgsn_ggsn_ctx_free(struct sgsn_ggsn_ctx *ggc);
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index 9f02d54..7174bd5 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -500,7 +500,7 @@
 	bool pending = osmo_timer_pending(&ggc->echo_timer);
 
 	/* Only enable if allowed by policy and at least 1 pdp ctx exists against ggsn */
-	if (!llist_empty(&ggc->pdp_list) && ggc->echo_interval > 0) {
+	if (!llist_empty(&ggc->pdp_list) && ggc->echo_interval) {
 		if (!pending)
 			osmo_timer_schedule(&ggc->echo_timer, ggc->echo_interval, 0);
 	} else {
@@ -528,7 +528,6 @@
 	ggc->id = id;
 	ggc->gtp_version = 1;
 	ggc->remote_restart_ctr = -1;
-	ggc->echo_interval = -1;
 	/* if we are called from config file parse, this gsn doesn't exist yet */
 	ggc->gsn = sgsn->gsn;
 	INIT_LLIST_HEAD(&ggc->pdp_list);
diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 68d3a77..42b5121 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -190,8 +190,8 @@
 			inet_ntoa(gctx->remote_addr), VTY_NEWLINE);
 		vty_out(vty, " ggsn %u gtp-version %u%s", gctx->id,
 			gctx->gtp_version, VTY_NEWLINE);
-		if (gctx->echo_interval != -1)
-			vty_out(vty, " ggsn %u echo-interval %"PRId32"%s",
+		if (gctx->echo_interval)
+			vty_out(vty, " ggsn %u echo-interval %u%s",
 				gctx->id, gctx->echo_interval, VTY_NEWLINE);
 		else
 			vty_out(vty, " ggsn %u no echo-interval%s",
@@ -395,7 +395,7 @@
 	uint32_t id = atoi(argv[0]);
 	struct sgsn_ggsn_ctx *ggc = sgsn_ggsn_ctx_find_alloc(id);
 
-	ggc->echo_interval = -1;
+	ggc->echo_interval = 0;
 	sgsn_ggsn_ctx_check_echo_timer(ggc);
 
 	return CMD_SUCCESS;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15304
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I689034887188a53590eddeffda781629694eb5ed
Gerrit-Change-Number: 15304
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190830/093c262a/attachment.htm>


More information about the gerrit-log mailing list