Change in ...libosmo-netif[master]: stream: Fix scheduling of queued messages during connecting state

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

pespin gerrit-no-reply at lists.osmocom.org
Thu Sep 5 10:00:29 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmo-netif/+/15404 )

Change subject: stream: Fix scheduling of queued messages during connecting state
......................................................................

stream: Fix scheduling of queued messages during connecting state

If messages are sent using osmo_stream_cli_send() while the stream
is still (re)connecting, they won't have a chance to be sent until the
stream is connected, and hence they are queued until
CONNECTING->CONNECTED is done. However, at that time
(osmo_stream_cli_fd_cb), the WRITE flag was dropped unconditionally,
which meant already queued packets didn't have the opportunity to be
sent by the same callback until first message is enqueued and WRITE flag
is set (again by osmo_stream_cli_send()).
Let's make them be sent as soon as possible once the connection is
available.

Related: OS#4188
Change-Id: I289495f9aad6389c5f2623fb072d676235b7d24c
---
M src/stream.c
1 file changed, 6 insertions(+), 1 deletion(-)

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



diff --git a/src/stream.c b/src/stream.c
index 74fe8b6..e9307a5 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -283,7 +283,12 @@
 			osmo_stream_cli_reconnect(cli);
 			return 0;
 		}
-		ofd->when &= ~BSC_FD_WRITE;
+
+		/* If messages got enqueued while 'connecting', keep WRITE flag
+		   up to dispatch them upon next main loop step */
+		if (llist_empty(&cli->tx_queue))
+			cli->ofd.when &= ~BSC_FD_WRITE;
+
 		LOGSCLI(cli, LOGL_DEBUG, "connection done.\n");
 		cli->state = STREAM_CLI_STATE_CONNECTED;
 		if (cli->proto == IPPROTO_SCTP) {

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/15404
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I289495f9aad6389c5f2623fb072d676235b7d24c
Gerrit-Change-Number: 15404
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190905/b18cdbb2/attachment.htm>


More information about the gerrit-log mailing list