It may be nice to deliver macro cs_repeat as default in some include
file.
Signed-off-by: Jan Friesse <[email protected]>
---
tools/corosync-cfgtool.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c
index 8ae41fd..7f235ef 100644
--- a/tools/corosync-cfgtool.c
+++ b/tools/corosync-cfgtool.c
@@ -51,6 +51,20 @@
#include <corosync/totem/totem.h>
#include <corosync/cfg.h>
+#define cs_repeat(result, max, code) \
+ do { \
+ int counter = 0; \
+ do { \
+ result = code; \
+ if (result == CS_ERR_TRY_AGAIN) { \
+ sleep(1); \
+ counter++; \
+ } else { \
+ break; \
+ } \
+ } while (counter < max); \
+ } while (0)
+
static void ringstatusget_do (void)
{
cs_error_t result;
@@ -163,7 +177,7 @@ static void shutdown_do(void)
}
printf ("Shutting down corosync\n");
- result = corosync_cfg_try_shutdown (handle,
COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST);
+ cs_repeat(result, 30, corosync_cfg_try_shutdown (handle,
COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST));
if (result != CS_OK) {
printf ("Could not shutdown (error = %d)\n", result);
}
--
1.7.1
_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss