<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-netif/+/15404">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stream: Fix scheduling of queued messages during connecting state<br><br>If messages are sent using osmo_stream_cli_send() while the stream<br>is still (re)connecting, they won't have a chance to be sent until the<br>stream is connected, and hence they are queued until<br>CONNECTING->CONNECTED is done. However, at that time<br>(osmo_stream_cli_fd_cb), the WRITE flag was dropped unconditionally,<br>which meant already queued packets didn't have the opportunity to be<br>sent by the same callback until first message is enqueued and WRITE flag<br>is set (again by osmo_stream_cli_send()).<br>Let's make them be sent as soon as possible once the connection is<br>available.<br><br>Change-Id: I289495f9aad6389c5f2623fb072d676235b7d24c<br>---<br>M src/stream.c<br>1 file changed, 6 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/04/15404/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/stream.c b/src/stream.c</span><br><span>index 74fe8b6..e9307a5 100644</span><br><span>--- a/src/stream.c</span><br><span>+++ b/src/stream.c</span><br><span>@@ -283,7 +283,12 @@</span><br><span>                     osmo_stream_cli_reconnect(cli);</span><br><span>                      return 0;</span><br><span>            }</span><br><span style="color: hsl(0, 100%, 40%);">-               ofd->when &= ~BSC_FD_WRITE;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          /* If messages got enqueued while 'connecting', keep WRITE flag</span><br><span style="color: hsl(120, 100%, 40%);">+                  up to dispatch them upon next main loop step */</span><br><span style="color: hsl(120, 100%, 40%);">+            if (llist_empty(&cli->tx_queue))</span><br><span style="color: hsl(120, 100%, 40%);">+                       cli->ofd.when &= ~BSC_FD_WRITE;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>             LOGSCLI(cli, LOGL_DEBUG, "connection done.\n");</span><br><span>            cli->state = STREAM_CLI_STATE_CONNECTED;</span><br><span>          if (cli->proto == IPPROTO_SCTP) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-netif/+/15404">change 15404</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/c/libosmo-netif/+/15404"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-netif </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I289495f9aad6389c5f2623fb072d676235b7d24c </div>
<div style="display:none"> Gerrit-Change-Number: 15404 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>