summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt-ping.c9
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c4
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt-ping.c b/rpc/rpc-lib/src/rpc-clnt-ping.c
index 948a244838e..21de9da4c1a 100644
--- a/rpc/rpc-lib/src/rpc-clnt-ping.c
+++ b/rpc/rpc-lib/src/rpc-clnt-ping.c
@@ -189,7 +189,9 @@ rpc_clnt_ping (struct rpc_clnt *rpc)
{
call_frame_t *frame = NULL;
int32_t ret = -1;
+ rpc_clnt_connection_t *conn = NULL;
+ conn = &rpc->conn;
frame = create_frame (THIS, THIS->ctx->pool);
if (!frame)
goto fail;
@@ -203,6 +205,13 @@ rpc_clnt_ping (struct rpc_clnt *rpc)
gf_log (THIS->name, GF_LOG_ERROR,
"failed to start ping timer");
}
+ else {
+ /* ping successfully queued in list of saved frames
+ * for the connection*/
+ pthread_mutex_lock (&conn->lock);
+ conn->pingcnt++;
+ pthread_mutex_unlock (&conn->lock);
+ }
return ret;
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index b831c537723..2ae2dfb71bf 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -527,6 +527,9 @@ rpc_clnt_connection_cleanup (rpc_clnt_connection_t *conn)
conn->ping_started = 0;
rpc_clnt_unref (clnt);
}
+ /*reset rpc msgs stats*/
+ conn->pingcnt = 0;
+ conn->msgcnt = 0;
}
pthread_mutex_unlock (&conn->lock);
@@ -1565,6 +1568,7 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
if ((ret >= 0) && frame) {
/* Save the frame in queue */
__save_frame (rpc, frame, rpcreq);
+ conn->msgcnt++;
gf_log ("rpc-clnt", GF_LOG_TRACE, "submitted request "
"(XID: 0x%x Program: %s, ProgVers: %d, "
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index f439d538761..6492a81f24e 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -146,6 +146,8 @@ struct rpc_clnt_connection {
int32_t ping_started;
char *name;
int32_t ping_timeout;
+ uint64_t pingcnt;
+ uint64_t msgcnt;
};
typedef struct rpc_clnt_connection rpc_clnt_connection_t;