aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2023-06-14 17:25:21 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2023-06-14 17:28:12 +0200
commit383f721cf79f4570c0c91d52de9c05f453dce21e (patch)
treea662b347abe53e584da7b69acfca4c1361a3aa30
parenta97bfa750e1c7fd81dd13cfc8223727cca52dba9 (diff)
stream: Correctly close osmo_stream_cli when in state WAIT_RECONNECT
If cli is in STREAM_CLI_STATE_WAIT_RECONNECT cli->timer is scheduled. Delete the timer if osmo_steam_cli_close() called so we don't end up reconnecting. Also fixes the recent test failures in master-libosmo-sccp Jenkins jobs. Change-Id: Ic5227432192c4007f861f171ae961a8f4dea6522
-rw-r--r--src/stream.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 6fb41f1..23efe24 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -308,6 +308,12 @@ void osmo_stream_cli_close(struct osmo_stream_cli *cli)
{
if (cli->state == STREAM_CLI_STATE_CLOSED)
return;
+ if (cli->state == STREAM_CLI_STATE_WAIT_RECONNECT) {
+ osmo_timer_del(&cli->timer);
+ cli->state = STREAM_CLI_STATE_CLOSED;
+ return;
+ }
+
osmo_fd_unregister(&cli->ofd);
close(cli->ofd.fd);
cli->ofd.fd = -1;