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.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 4c8333b7d5d..20981ef9c9c 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1744,6 +1744,47 @@ out:
return;
}
+void
+rpc_clnt_disconnect (struct rpc_clnt *rpc)
+{
+ rpc_clnt_connection_t *conn = NULL;
+ rpc_transport_t *trans = NULL;
+
+ if (!rpc)
+ goto out;
+
+ conn = &rpc->conn;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ if (conn->timer) {
+ gf_timer_call_cancel (rpc->ctx, conn->timer);
+ conn->timer = NULL;
+ }
+
+ if (conn->reconnect) {
+ gf_timer_call_cancel (rpc->ctx, conn->reconnect);
+ conn->reconnect = NULL;
+ }
+ conn->connected = 0;
+
+ if (conn->ping_timer) {
+ gf_timer_call_cancel (rpc->ctx, conn->ping_timer);
+ conn->ping_timer = NULL;
+ conn->ping_started = 0;
+ }
+ trans = conn->trans;
+ }
+ pthread_mutex_unlock (&conn->lock);
+
+ if (trans) {
+ rpc_transport_disconnect (trans);
+ }
+
+out:
+ return;
+}
+
void
rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config)