aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/stream.c5
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) {