From ab1498882c1f2b7d4ad63855aa0991c1d1cf9f09 Mon Sep 17 00:00:00 2001 From: William Murphy <warrendiogenese@gmail.com> Date: Thu, 7 Aug 2014 22:31:01 -0700 Subject: [PATCH 1/2] Patched timeout --- lib/sendmsg.c | 1 + lib/sendmsg.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sendmsg.c b/lib/sendmsg.c index d13d85f..de9cc0c 100644 --- a/lib/sendmsg.c +++ b/lib/sendmsg.c @@ -641,6 +641,7 @@ sendresult_t sendmessage(char *msg, char *recipient, int timeout, sendreturn_t * *errordetails = '\0'; + if (!timeout || timeout == XYMON_TIMEOUT) timeout = (getenv("XYMON_TIMEOUT") != NULL) ? atoi(xgetenv("XYMON_TIMEOUT")) : REALXYMON_TIMEOUT; if ((xymsrv == NULL) && xgetenv("XYMSRV")) xymsrv = strdup(xgetenv("XYMSRV")); if (recipient == NULL) recipient = xymsrv; if ((recipient == NULL) && xgetenv("XYMSERVERS")) { diff --git a/lib/sendmsg.h b/lib/sendmsg.h index 6bd1dbb..f66422a 100644 --- a/lib/sendmsg.h +++ b/lib/sendmsg.h @@ -11,7 +11,8 @@ #ifndef __SENDMSG_H_ #define __SENDMSG_H_ -#define XYMON_TIMEOUT 15 /* Default timeout for a request going to Xymon server */ +#define XYMON_TIMEOUT -2 /* Fake default timeout for a request going to Xymon server */ +#define REALXYMON_TIMEOUT 15 /* Real default timeout for a request going to Xymon server */ #define PAGELEVELSDEFAULT "red purple" typedef enum { -- 1.8.4.5 From 9183acb1b1c611ec21f1fadaad54bfc727680aa5 Mon Sep 17 00:00:00 2001 From: William Murphy <warrendiogenese@gmail.com> Date: Thu, 7 Aug 2014 22:31:01 -0700 Subject: [PATCH 2/2] Patched retries --- lib/sendmsg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sendmsg.c b/lib/sendmsg.c index de9cc0c..7b4fb4f 100644 --- a/lib/sendmsg.c +++ b/lib/sendmsg.c @@ -159,7 +159,7 @@ static int sendtoxymond(char *recipient, char *message, FILE *respfd, char **res char *p; char *rcptip = NULL; int rcptport = 0; - int connretries = SENDRETRIES; + int connretries = 0; char *httpmessage = NULL; char recvbuf[32768]; int haveseenhttphdrs = 1; @@ -173,6 +173,9 @@ static int sendtoxymond(char *recipient, char *message, FILE *respfd, char **res return XYMONSEND_OK; } + connretries = (getenv("XYMON_RETRIES") != NULL) ? atoi(xgetenv("XYMON_RETRIES")) : SENDRETRIES; + dbgprintf("Will retry %d times\n", connretries); + setup_transport(recipient); dbgprintf("Recipient listed as '%s'\n", recipient); -- 1.8.4.5