<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14211">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gtp: Take queue_resp into account to schedule retrans timer<br><br>Before this patch they were not taken into account, which means some<br>resp messages could stay more time than required enqueued.<br><br>Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030<br>---<br>M gtp/gtp.c<br>1 file changed, 15 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/11/14211/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/gtp/gtp.c b/gtp/gtp.c</span><br><span>index b98fba0..b50b592 100644</span><br><span>--- a/gtp/gtp.c</span><br><span>+++ b/gtp/gtp.c</span><br><span>@@ -590,22 +590,34 @@</span><br><span> </span><br><span> int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-     time_t now, later;</span><br><span style="color: hsl(120, 100%, 40%);">+    time_t now, later, diff;</span><br><span>     struct qmsg_t *qmsg;</span><br><span style="color: hsl(120, 100%, 40%);">+  timeout->tv_usec = 0;</span><br><span> </span><br><span>         if (queue_getfirst(gsn->queue_req, &qmsg)) {</span><br><span>          timeout->tv_sec = 10;</span><br><span style="color: hsl(0, 100%, 40%);">-                timeout->tv_usec = 0;</span><br><span>     } else {</span><br><span>             now = time(NULL);</span><br><span>            later = qmsg->timeout;</span><br><span>            timeout->tv_sec = later - now;</span><br><span style="color: hsl(0, 100%, 40%);">-               timeout->tv_usec = 0;</span><br><span>             if (timeout->tv_sec < 0)</span><br><span>                       timeout->tv_sec = 0; /* No negative allowed */</span><br><span>            if (timeout->tv_sec > 10)</span><br><span>                      timeout->tv_sec = 10;        /* Max sleep for 10 sec */</span><br><span>   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (queue_getfirst(gsn->queue_resp, &qmsg)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          /* already set by queue_req, do nothing */</span><br><span style="color: hsl(120, 100%, 40%);">+    } else { /* trigger faster if earlier timeout exists in queue_resp */</span><br><span style="color: hsl(120, 100%, 40%);">+         now = time(NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+             later = qmsg->timeout;</span><br><span style="color: hsl(120, 100%, 40%);">+             diff = later - now;</span><br><span style="color: hsl(120, 100%, 40%);">+           if (diff < 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                      diff = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (diff < timeout->tv_sec)</span><br><span style="color: hsl(120, 100%, 40%);">+                     timeout->tv_sec = diff;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14211">change 14211</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/14211"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ggsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iebf405b2310a34785f3b363cc2a9f415281f6030 </div>
<div style="display:none"> Gerrit-Change-Number: 14211 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>