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 <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to