diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2015-02-11 17:13:45 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-02-20 04:04:08 -0800 |
commit | 9d842f965655bf70c643b4541844e83bc4e74190 (patch) | |
tree | 4d248f27d77993a478267a41e0517228214d7fa0 /rpc | |
parent | 571a71f0acd0ec59340b9d0d2519793e33a1dc16 (diff) |
glusterd: nfs,shd,quotad,snapd daemons refactoring
This patch ports nfs, shd, quotad & snapd with the approach suggested in
http://www.gluster.org/pipermail/gluster-devel/2014-December/043180.html
Change-Id: I4ea5b38793f87fc85cc9d2cf873727351dedffd2
BUG: 1191486
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/9428
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 41 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.h | 3 |
2 files changed, 44 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) diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index 6492a81f24e..faae4855a6c 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -244,6 +244,9 @@ int rpcclnt_cbk_program_register (struct rpc_clnt *svc, void rpc_clnt_disable (struct rpc_clnt *rpc); +void +rpc_clnt_disconnect (struct rpc_clnt *rpc); + char rpc_clnt_is_disabled (struct rpc_clnt *rpc); |