diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-03-17 00:14:38 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-03-17 00:24:23 +0100 |
commit | 781e7b38f87b1a8a4ddf65a040935750aabc2b6e (patch) | |
tree | f66e45ca12677a7fe7718dd4e6e984aa96d40e1b /src | |
parent | 538e5cd52a3cd9ddac375a645eb579feae0c2101 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/stream.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 @@ int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect) 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) { |