Patchwork [BUG:2078] rpc-clnt: move rpc_clnt_reconnect() call to rpc_clnt_init

login
register
Submitter Anand Avati
Date 2010-11-16 13:45:48
Message ID <20101116134548.GA11013@dev.gluster.com>
Download mbox | patch
Permalink /patch/5719/
State Accepted
Headers show

Comments

Anand Avati - 2010-11-16 13:45:48
Previously rpc_clnt_reconnect() was called inside rpc_clnt_connection_init
which in turn was called from rpc_clnt_init. This change makes
rpc_clnt_connection_init re-usable for the next patch

Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
---
 rpc/rpc-lib/src/rpc-clnt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index a53ac4d..15b8ff3 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -959,8 +959,6 @@  rpc_clnt_connection_init (struct rpc_clnt *clnt, glusterfs_ctx_t *ctx,
                 goto out;
         }
 
-        rpc_clnt_reconnect (conn->trans);
-
         ret = 0;
 
 out:
@@ -974,6 +972,7 @@  rpc_clnt_init (struct rpc_clnt_config *config, dict_t *options,
 {
         int                    ret  = -1;
         struct rpc_clnt       *rpc  = NULL;
+        struct rpc_clnt_connection *conn = NULL;
 
         rpc = GF_CALLOC (1, sizeof (*rpc), gf_common_mt_rpcclnt_t);
         if (!rpc) {
@@ -1015,6 +1014,9 @@  rpc_clnt_init (struct rpc_clnt_config *config, dict_t *options,
                 goto out;
         }
 
+        conn = &rpc->conn;
+        rpc_clnt_reconnect (conn->trans);
+
         rpc = rpc_clnt_ref (rpc);
         INIT_LIST_HEAD (&rpc->programs);