summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-03-28 11:03:34 +0530
committerPranith Kumar K <pkarampu@redhat.com>2019-03-28 11:05:25 +0530
commit108e4f3481225f98c12f7c283e1ef0388863cf8b (patch)
tree764086cdb3b039b9986f0adc27a36dccf8885f17 /rpc
parenta7110486d048fa379f33ae4e0ba94b5ef3560489 (diff)
rpc: Remove duplicate code
rpc_clnt_disable() and rpc_clnt_disconnect() have same code. Removed rpc_clnt_disconnect() and moved calls to rpc_clnt_disconnect() to rpc_clnt_disable() updates bz#1193929 Change-Id: I965f57cc1d5af36d266810125558b6f5e5f279d4 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/libgfrpc.sym1
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c74
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h3
3 files changed, 1 insertions, 77 deletions
diff --git a/rpc/rpc-lib/src/libgfrpc.sym b/rpc/rpc-lib/src/libgfrpc.sym
index f3544e3..54d1be1 100644
--- a/rpc/rpc-lib/src/libgfrpc.sym
+++ b/rpc/rpc-lib/src/libgfrpc.sym
@@ -3,7 +3,6 @@ rpcclnt_cbk_program_register
rpc_clnt_cleanup_and_start
rpc_clnt_connection_cleanup
rpc_clnt_disable
-rpc_clnt_disconnect
rpc_clnt_new
rpc_clnt_reconfig
rpc_clnt_reconnect
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index b04eaed..8ef0537 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1786,7 +1786,7 @@ rpc_clnt_trigger_destroy(struct rpc_clnt *rpc)
* ref*/
conn = &rpc->conn;
trans = conn->trans;
- rpc_clnt_disconnect(rpc);
+ rpc_clnt_disable(rpc);
/* This is to account for rpc_clnt_disable that might have been called
* before rpc_clnt_unref */
@@ -1934,78 +1934,6 @@ out:
}
void
-rpc_clnt_disconnect(struct rpc_clnt *rpc)
-{
- rpc_clnt_connection_t *conn = NULL;
- rpc_transport_t *trans = NULL;
- int unref = 0;
- int ret = 0;
- gf_boolean_t timer_unref = _gf_false;
- gf_boolean_t reconnect_unref = _gf_false;
-
- if (!rpc)
- goto out;
-
- conn = &rpc->conn;
-
- pthread_mutex_lock(&conn->lock);
- {
- rpc->disabled = 1;
- if (conn->timer) {
- ret = gf_timer_call_cancel(rpc->ctx, conn->timer);
- /* If the event is not fired and it actually cancelled
- * the timer, do the unref else registered call back
- * function will take care of unref.
- */
- if (!ret)
- timer_unref = _gf_true;
- conn->timer = NULL;
- }
-
- if (conn->reconnect) {
- ret = gf_timer_call_cancel(rpc->ctx, conn->reconnect);
- if (!ret)
- reconnect_unref = _gf_true;
- conn->reconnect = NULL;
- }
- conn->connected = 0;
-
- unref = rpc_clnt_remove_ping_timer_locked(rpc);
- trans = conn->trans;
- }
- pthread_mutex_unlock(&conn->lock);
-
- if (trans) {
- rpc_transport_disconnect(trans, _gf_true);
- /* The auth_value was being reset to AUTH_GLUSTERFS_v2.
- * if (clnt->auth_value)
- * clnt->auth_value = AUTH_GLUSTERFS_v2;
- * It should not be reset here. The disconnect during
- * portmap request can race with handshake. If handshake
- * happens first and disconnect later, auth_value would set
- * to default value and it never sets back to actual auth_value
- * supported by server. But it's important to set to lower
- * version supported in the case where the server downgrades.
- * So moving this code to RPC_TRANSPORT_CONNECT. Note that
- * CONNECT cannot race with handshake as by nature it is
- * serialized with handhake. An handshake can happen only
- * on a connected transport and hence its strictly serialized.
- */
- }
- if (unref)
- rpc_clnt_unref(rpc);
-
- if (timer_unref)
- rpc_clnt_unref(rpc);
-
- if (reconnect_unref)
- rpc_clnt_unref(rpc);
-
-out:
- return;
-}
-
-void
rpc_clnt_reconfig(struct rpc_clnt *rpc, struct rpc_clnt_config *config)
{
if (config->ping_timeout) {
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index d16cc40..b46feed 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -253,9 +253,6 @@ rpcclnt_cbk_program_register(struct rpc_clnt *svc,
void
rpc_clnt_disable(struct rpc_clnt *rpc);
-void
-rpc_clnt_disconnect(struct rpc_clnt *rpc);
-
int
rpc_clnt_mgmt_pmap_signout(glusterfs_ctx_t *ctx, char *brick_name);