[MERGED] libosmo-netif[master]: stream_client: Actually use/honor the reconect parameter

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Mar 17 21:09:22 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: stream_client: Actually use/honor the reconect parameter
......................................................................


stream_client: Actually use/honor the reconect parameter

The reconnect behavior was likely broken in commit
de3f57a8293a5b39435d6f283da23e0172bad8bb

If the user requests a re-connect, we should start it. Not only in case
the connection drops later, but also if the initial connection itself
fails.

Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b
---
M src/stream.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/stream.c b/src/stream.c
index a30fd04..d72d800 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -308,8 +308,11 @@
 	ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto,
 			     cli->addr, cli->port,
 			     OSMO_SOCK_F_CONNECT);
-	if (ret < 0)
+	if (ret < 0) {
+		if (reconnect && errno == ECONNREFUSED)
+			osmo_stream_cli_reconnect(cli);
 		return ret;
+	}
 
 	cli->ofd.fd = ret;
 	if (osmo_fd_register(&cli->ofd) < 0) {

-- 
To view, visit https://gerrit.osmocom.org/2110
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I817e026404cbd9145cae2ce90bc57a1db1d2e12b
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list