aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-07-24 10:33:11 +0200
committerDamjan Marion <dmarion@me.com>2019-07-26 14:51:59 +0000
commit272e2e456dd9441778f9bf78f72b0301aa5f9224 (patch)
tree38befcac3ec75a1db85f7d91c2e0c571b5187c50 /extras
parentaf57799fdeab9f890750a3f717812e8ffe8b7d11 (diff)
libmemif: fix autoconnect
Type: fix Change-Id: I426e210c47869904a01712b765db2356439f706f Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/libmemif/src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 5f92f029a8a..42dfeafb247 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -901,8 +901,6 @@ memif_create (memif_conn_handle_t * c, memif_conn_args_t * args,
}
else
{
- lm->disconn_slaves++;
-
elt.key = -1;
elt.data_struct = conn;
if ((index =
@@ -916,7 +914,7 @@ memif_create (memif_conn_handle_t * c, memif_conn_args_t * args,
/* try connectiong to master */
err = memif_request_connection (conn);
- if ((err < 0) && (lm->disconn_slaves == 1))
+ if ((err != MEMIF_ERR_SUCCESS) && (lm->disconn_slaves == 0))
{
/* connection failed, arm reconnect timer (if not armed) */
if (timerfd_settime (lm->timerfd, 0, &lm->arm, NULL) < 0)
@@ -925,6 +923,7 @@ memif_create (memif_conn_handle_t * c, memif_conn_args_t * args,
goto error;
}
}
+ lm->disconn_slaves++;
}
*c = conn;
@@ -995,8 +994,9 @@ memif_request_connection (memif_conn_handle_t c)
}
else
{
+ err = memif_syscall_error_handler (errno);
strcpy ((char *) conn->remote_disconnect_string,
- memif_strerror (memif_syscall_error_handler (errno)));
+ memif_strerror (err));
goto error;
}