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.c4
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c12
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h4
3 files changed, 6 insertions, 14 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt-ping.c b/rpc/rpc-lib/src/rpc-clnt-ping.c
index 2f11341b0d5..40077e7aefd 100644
--- a/rpc/rpc-lib/src/rpc-clnt-ping.c
+++ b/rpc/rpc-lib/src/rpc-clnt-ping.c
@@ -112,7 +112,7 @@ rpc_clnt_ping_timer_expired (void *rpc_ptr)
rpc_clnt_connection_t *conn = NULL;
int disconnect = 0;
int transport_activity = 0;
- struct timeval current = {0, };
+ struct timespec current = {0, };
int unref = 0;
rpc = (struct rpc_clnt*) rpc_ptr;
@@ -129,7 +129,7 @@ rpc_clnt_ping_timer_expired (void *rpc_ptr)
{
unref = rpc_clnt_remove_ping_timer_locked (rpc);
- gettimeofday (&current, NULL);
+ clock_gettime (CLOCK_REALTIME, &current);
if (((current.tv_sec - conn->last_received.tv_sec) <
conn->ping_timeout)
|| ((current.tv_sec - conn->last_sent.tv_sec) <
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index adb8e3d4a60..cb59408dcf6 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -965,11 +965,7 @@ rpc_clnt_notify (rpc_transport_t *trans, void *mydata,
case RPC_TRANSPORT_MSG_RECEIVED:
{
- pthread_mutex_lock (&conn->lock);
- {
- gettimeofday (&conn->last_received, NULL);
- }
- pthread_mutex_unlock (&conn->lock);
+ clock_gettime (CLOCK_REALTIME, &conn->last_received);
pollin = data;
if (pollin->is_reply)
@@ -984,11 +980,7 @@ rpc_clnt_notify (rpc_transport_t *trans, void *mydata,
case RPC_TRANSPORT_MSG_SENT:
{
- pthread_mutex_lock (&conn->lock);
- {
- gettimeofday (&conn->last_sent, NULL);
- }
- pthread_mutex_unlock (&conn->lock);
+ clock_gettime (CLOCK_REALTIME, &conn->last_sent);
ret = 0;
break;
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index 952ecbce1a1..428ffb80650 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -143,8 +143,8 @@ struct rpc_clnt_connection {
gf_boolean_t disconnected;
struct saved_frames *saved_frames;
int32_t frame_timeout;
- struct timeval last_sent;
- struct timeval last_received;
+ struct timespec last_sent;
+ struct timespec last_received;
int32_t ping_started;
char *name;
int32_t ping_timeout;