summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpc-clnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/rpc-lib/src/rpc-clnt.c')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 2ae3bbad370..27e394093cf 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -782,6 +782,7 @@ rpc_clnt_set_connected (rpc_clnt_connection_t *conn)
pthread_mutex_lock (&conn->lock);
{
conn->connected = 1;
+ conn->disconnected = _gf_false;
}
pthread_mutex_unlock (&conn->lock);
@@ -800,6 +801,7 @@ rpc_clnt_unset_connected (rpc_clnt_connection_t *conn)
pthread_mutex_lock (&conn->lock);
{
conn->connected = 0;
+ conn->disconnected = _gf_true;
}
pthread_mutex_unlock (&conn->lock);
@@ -807,6 +809,24 @@ out:
return;
}
+gf_boolean_t
+is_rpc_clnt_disconnected (rpc_clnt_connection_t *conn)
+{
+ gf_boolean_t disconnected = _gf_true;
+
+ if (!conn)
+ return disconnected;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ if (conn->disconnected == _gf_false)
+ disconnected = _gf_false;
+ }
+ pthread_mutex_unlock (&conn->lock);
+
+ return disconnected;
+}
+
static void
rpc_clnt_destroy (struct rpc_clnt *rpc);