summaryrefslogtreecommitdiffstats
path: root/lib/common/ipc_attrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/ipc_attrd.c')
-rw-r--r--lib/common/ipc_attrd.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/common/ipc_attrd.c b/lib/common/ipc_attrd.c
index 7c40aa7..9caaabe 100644
--- a/lib/common/ipc_attrd.c
+++ b/lib/common/ipc_attrd.c
@@ -44,7 +44,7 @@ set_pairs_data(pcmk__attrd_api_reply_t *data, xmlNode *msg_data)
}
static bool
-reply_expected(pcmk_ipc_api_t *api, xmlNode *request)
+reply_expected(pcmk_ipc_api_t *api, const xmlNode *request)
{
const char *command = crm_element_value(request, PCMK__XA_TASK);
@@ -169,32 +169,29 @@ destroy_api(pcmk_ipc_api_t *api)
}
static int
-connect_and_send_attrd_request(pcmk_ipc_api_t *api, xmlNode *request)
+connect_and_send_attrd_request(pcmk_ipc_api_t *api, const xmlNode *request)
{
int rc = pcmk_rc_ok;
- int max = 5;
-
- while (max > 0) {
- crm_info("Connecting to cluster... %d retries remaining", max);
- rc = pcmk_connect_ipc(api, pcmk_ipc_dispatch_sync);
-
- if (rc == pcmk_rc_ok) {
- rc = pcmk__send_ipc_request(api, request);
- break;
- } else if (rc == EAGAIN || rc == EALREADY) {
- sleep(5 - max);
- max--;
- } else {
- crm_err("Could not connect to attrd: %s", pcmk_rc_str(rc));
- break;
- }
+
+ rc = pcmk__connect_ipc(api, pcmk_ipc_dispatch_sync, 5);
+ if (rc != pcmk_rc_ok) {
+ crm_err("Could not connect to %s: %s",
+ pcmk_ipc_name(api, true), pcmk_rc_str(rc));
+ return rc;
}
- return rc;
+ rc = pcmk__send_ipc_request(api, request);
+ if (rc != pcmk_rc_ok) {
+ crm_err("Could not send request to %s: %s",
+ pcmk_ipc_name(api, true), pcmk_rc_str(rc));
+ return rc;
+ }
+
+ return pcmk_rc_ok;
}
static int
-send_attrd_request(pcmk_ipc_api_t *api, xmlNode *request)
+send_attrd_request(pcmk_ipc_api_t *api, const xmlNode *request)
{
return pcmk__send_ipc_request(api, request);
}