File pacemaker-libcrmcommon-remote-connection-polling-messages.patch of Package pacemaker.14737
commit ae362daa1bdc7b2ae76d8761a1eab0abda6e44e9
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Thu Feb 23 18:03:27 2017 -0600
Log: libcrmcommon: improve remote connection polling messages
Most satisfyingly, downgrade -EAGAIN to a trace.
diff --git a/lib/common/remote.c b/lib/common/remote.c
index 80a75818f..ad9cea839 100644
--- a/lib/common/remote.c
+++ b/lib/common/remote.c
@@ -601,13 +601,16 @@ crm_remote_recv_once(crm_remote_t * remote)
/*!
* \internal
- * \brief Read data off the socket until at least one full message is present or timeout occures.
- * \retval TRUE message read
- * \retval FALSE full message not read
+ * \brief Read message(s) from a remote connection
+ *
+ * \param[in] remote Remote connection to read
+ * \param[in] total_timeout Fail if message not read in this time (ms)
+ * \param[out] disconnected Will be set to 1 if disconnect detected
+ *
+ * \return TRUE if at least one full message read, FALSE otherwise
*/
-
gboolean
-crm_remote_recv(crm_remote_t * remote, int total_timeout /*ms */ , int *disconnected)
+crm_remote_recv(crm_remote_t *remote, int total_timeout, int *disconnected)
{
int rc;
time_t start = time(NULL);
@@ -623,28 +626,32 @@ crm_remote_recv(crm_remote_t * remote, int total_timeout /*ms */ , int *disconne
remaining_timeout = total_timeout;
while ((remaining_timeout > 0) && !(*disconnected)) {
- /* read some more off the tls buffer if we still have time left. */
- crm_trace("waiting to receive remote msg, starting timeout %d, remaining_timeout %d",
- total_timeout, remaining_timeout);
+ crm_trace("Waiting for remote data (%d of %d ms timeout remaining)",
+ remaining_timeout, total_timeout);
rc = crm_remote_ready(remote, remaining_timeout);
if (rc == 0) {
- crm_err("poll timed out (%d ms) while waiting to receive msg", remaining_timeout);
+ crm_err("Timed out (%d ms) while waiting for remote data",
+ remaining_timeout);
return FALSE;
- } else if(rc < 0) {
- crm_debug("could not poll: %s (%d)", pcmk_strerror(rc), rc);
+ } else if (rc < 0) {
+ crm_debug("Wait for remote data aborted, will try again: %s "
+ CRM_XS " rc=%d", pcmk_strerror(rc), rc);
} else {
rc = crm_remote_recv_once(remote);
- if(rc > 0) {
+ if (rc > 0) {
return TRUE;
+ } else if (rc == -EAGAIN) {
+ crm_trace("Still waiting for remote data");
} else if (rc < 0) {
- crm_debug("recv() failed: %s (%d)", pcmk_strerror(rc), rc);
+ crm_debug("Could not receive remote data: %s " CRM_XS " rc=%d",
+ pcmk_strerror(rc), rc);
}
}
- if(rc == -ENOTCONN) {
+ if (rc == -ENOTCONN) {
*disconnected = 1;
return FALSE;
}