Change in osmo-ggsn[master]: gtp: Take queue_resp into account to schedule retrans timer

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
Fri May 31 14:25:57 UTC 2019


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

Change subject: gtp: Take queue_resp into account to schedule retrans timer
......................................................................

gtp: Take queue_resp into account to schedule retrans timer

Before this patch they were not taken into account, which means some
resp messages could stay more time than required enqueued.

Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030
---
M gtp/gtp.c
1 file changed, 15 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/gtp/gtp.c b/gtp/gtp.c
index 430eeb4..7dafefd 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -590,22 +590,34 @@
 
 int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout)
 {
-	time_t now, later;
+	time_t now, later, diff;
 	struct qmsg_t *qmsg;
+	timeout->tv_usec = 0;
 
 	if (queue_getfirst(gsn->queue_req, &qmsg)) {
 		timeout->tv_sec = 10;
-		timeout->tv_usec = 0;
 	} else {
 		now = time(NULL);
 		later = qmsg->timeout;
 		timeout->tv_sec = later - now;
-		timeout->tv_usec = 0;
 		if (timeout->tv_sec < 0)
 			timeout->tv_sec = 0;	/* No negative allowed */
 		if (timeout->tv_sec > 10)
 			timeout->tv_sec = 10;	/* Max sleep for 10 sec */
 	}
+
+	if (queue_getfirst(gsn->queue_resp, &qmsg)) {
+		/* already set by queue_req, do nothing */
+	} else { /* trigger faster if earlier timeout exists in queue_resp */
+		now = time(NULL);
+		later = qmsg->timeout;
+		diff = later - now;
+		if (diff < 0)
+			diff = 0;
+		if (diff < timeout->tv_sec)
+			timeout->tv_sec = diff;
+	}
+
 	return 0;
 }
 

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030
Gerrit-Change-Number: 14211
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190531/d86a2319/attachment.htm>


More information about the gerrit-log mailing list