diff --git a/src/ckpool.c b/src/ckpool.c index f7ec1fbe..3b968f7d 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -359,7 +359,7 @@ static int send_procmsg(proc_instance_t *pi, const char *buf) } sockd = open_unix_client(path); if (unlikely(sockd < 0)) { - LOGWARNING("Failed to open socket %s in send_recv_proc", path); + LOGWARNING("Failed to open socket %s in send_procmsg", path); goto out; } if (unlikely(!send_unix_msg(sockd, buf))) @@ -640,8 +640,8 @@ out: /* Send a single message to a process instance and retrieve the response, then * close the socket. */ -char *_send_recv_proc(proc_instance_t *pi, int writetimeout, int readtimedout, - const char *msg, const char *file, const char *func, const int line) +char *_send_recv_proc(proc_instance_t *pi, const char *msg, int writetimeout, int readtimedout, + const char *file, const char *func, const int line) { char *path = pi->us.path, *buf = NULL; int sockd; @@ -727,10 +727,10 @@ char *_ckdb_msg_call(const ckpool_t *ckp, const char *msg, const char *file, co json_t *json_rpc_call(connsock_t *cs, const char *rpc_req) { + float timeout = RPC_TIMEOUT; char *http_req = NULL; json_error_t err_val; json_t *val = NULL; - float timeout = 60; int len, ret; if (unlikely(cs->fd < 0)) { diff --git a/src/ckpool.h b/src/ckpool.h index 12ee8612..573ddc8f 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -19,6 +19,8 @@ #include "libckpool.h" #include "uthash.h" +#define RPC_TIMEOUT 60 + struct ckpool_instance; typedef struct ckpool_instance ckpool_t; @@ -245,9 +247,9 @@ void empty_buffer(connsock_t *cs); int read_socket_line(connsock_t *cs, float *timeout); void _send_proc(proc_instance_t *pi, const char *msg, const char *file, const char *func, const int line); #define send_proc(pi, msg) _send_proc(pi, msg, __FILE__, __func__, __LINE__) -char *_send_recv_proc(proc_instance_t *pi, int writetimeout, int readtimedout, - const char *msg, const char *file, const char *func, const int line); -#define send_recv_proc(pi, msg) _send_recv_proc(pi, UNIX_WRITE_TIMEOUT, UNIX_READ_TIMEOUT, msg, __FILE__, __func__, __LINE__) +char *_send_recv_proc(proc_instance_t *pi, const char *msg, int writetimeout, int readtimedout, + const char *file, const char *func, const int line); +#define send_recv_proc(pi, msg) _send_recv_proc(pi, msg, UNIX_WRITE_TIMEOUT, UNIX_READ_TIMEOUT, __FILE__, __func__, __LINE__) char *_send_recv_ckdb(const ckpool_t *ckp, const char *msg, const char *file, const char *func, const int line); #define send_recv_ckdb(ckp, msg) _send_recv_ckdb(ckp, msg, __FILE__, __func__, __LINE__) char *_ckdb_msg_call(const ckpool_t *ckp, const char *msg, const char *file, const char *func, diff --git a/src/stratifier.c b/src/stratifier.c index 0d3382de..243a9df9 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -832,7 +832,7 @@ static char *__send_recv_generator(ckpool_t *ckp, const char *msg, const int pri set = true; } else set = false; - buf = send_recv_proc(ckp->generator, msg); + buf = _send_recv_proc(ckp->generator, msg, UNIX_WRITE_TIMEOUT, RPC_TIMEOUT, __FILE__, __func__, __LINE__); if (unlikely(!buf)) buf = strdup("failed"); if (set)