From 1688b4f5d74be792057cd8c4b26ebd9dae98cdbf Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 Dec 2016 20:16:27 +1100 Subject: [PATCH] Remove use of send_recv_proc internally from ckpool.c --- src/ckpool.c | 4 ++-- src/connector.c | 3 ++- src/connector.h | 1 + src/stratifier.c | 3 ++- src/stratifier.h | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 307b3d89..d0b0e975 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -476,12 +476,12 @@ retry: } } else if (cmdmatch(buf, "stratifierstats")) { LOGDEBUG("Listener received stratifierstats request"); - msg = send_recv_proc(ckp->stratifier, "stats"); + msg = stratifier_stats(ckp, ckp->sdata); send_unix_msg(sockd, msg); dealloc(msg); } else if (cmdmatch(buf, "connectorstats")) { LOGDEBUG("Listener received connectorstats request"); - msg = send_recv_proc(ckp->connector, "stats"); + msg = connector_stats(ckp->cdata, 0); send_unix_msg(sockd, msg); dealloc(msg); } else if (cmdmatch(buf, "ckdbflush")) { diff --git a/src/connector.c b/src/connector.c index 91b91183..95019419 100644 --- a/src/connector.c +++ b/src/connector.c @@ -1293,11 +1293,12 @@ static void drop_passthrough_client(cdata_t *cdata, const int64_t id) send_client(cdata, id, msg); } -static char *connector_stats(cdata_t *cdata, const int runtime) +char *connector_stats(void *data, const int runtime) { json_t *val = json_object(), *subval; client_instance_t *client; int objects, generated; + cdata_t *cdata = data; sender_send_t *send; int64_t memsize; char *buf; diff --git a/src/connector.h b/src/connector.h index 03146e63..2a52c666 100644 --- a/src/connector.h +++ b/src/connector.h @@ -12,6 +12,7 @@ void connector_upstream_msg(ckpool_t *ckp, char *msg); void connector_add_message(ckpool_t *ckp, json_t *val); +char *connector_stats(void *data, const int runtime); void *connector(void *arg); #endif /* CONNECTOR_H */ diff --git a/src/stratifier.c b/src/stratifier.c index f034cbe1..5a39bcaf 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3570,10 +3570,11 @@ static void ckmsgq_stats(ckmsgq_t *ckmsgq, const int size, json_t **val) JSON_CPACK(*val, "{si,si,si}", "count", objects, "memory", memsize, "generated", generated); } -static char *stratifier_stats(ckpool_t *ckp, sdata_t *sdata) +char *stratifier_stats(ckpool_t *ckp, void *data) { json_t *val = json_object(), *subval; int objects, generated; + sdata_t *sdata = data; int64_t memsize; char *buf; diff --git a/src/stratifier.h b/src/stratifier.h index 259c4acc..6d4a5774 100644 --- a/src/stratifier.h +++ b/src/stratifier.h @@ -13,6 +13,7 @@ void parse_remote_txns(ckpool_t *ckp, const json_t *val); #define parse_upstream_txns(ckp, val) parse_remote_txns(ckp, val) void parse_upstream_auth(ckpool_t *ckp, json_t *val); +char *stratifier_stats(ckpool_t *ckp, void *data); void stratifier_add_recv(ckpool_t *ckp, json_t *val); void *stratifier(void *arg);