aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-09-04 17:32:32 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-09-04 17:40:22 +0200
commita1e9de1ec4847b2f571065aa4ad8b9795d282418 (patch)
tree76b3c2d9ba99f30fa6c8b28a689f1aedc6cbce9c
parent962bf9a48eed418354685dc733b8271d2dd62c27 (diff)
stream: Fix scheduling of queued messages during connecting statepespin/master
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
-rw-r--r--src/stream.c7
1 files changed, 6 insertions, 1 deletions
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 @@ static int osmo_stream_cli_fd_cb(struct osmo_fd *ofd, unsigned int what)
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) {