From ce9f328aa93892ea79057c41c70836eb49fae8b5 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Tue, 16 Nov 2010 08:17:07 +0000 Subject: protocol/client: use the new rpc_clnt initialization methods This way of initializing an rpc_clnt object by splitting into a passive rpc_clnt_new and a delayed rpc_clnt_start between which registration of callback programs and notify methods are performed provides a race-free way to avoid the missing of connect notifications Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 2078 (Volume Migration is not working) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2078 --- xlators/protocol/client/src/client.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 6a401217305..198ba082add 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1607,7 +1607,6 @@ int notify (xlator_t *this, int32_t event, void *data, ...) { clnt_conf_t *conf = NULL; - void *trans = NULL; conf = this->private; if (!conf) @@ -1616,20 +1615,11 @@ notify (xlator_t *this, int32_t event, void *data, ...) switch (event) { case GF_EVENT_PARENT_UP: { - if (conf->rpc) - trans = conf->rpc->conn.trans; - - if (!trans) { - gf_log (this->name, GF_LOG_DEBUG, - "transport init failed"); - return 0; - } - gf_log (this->name, GF_LOG_DEBUG, "got GF_EVENT_PARENT_UP, attempting connect " "on transport"); - rpc_clnt_reconnect (trans); + rpc_clnt_start (conf->rpc); } break; @@ -1761,7 +1751,7 @@ client_init_rpc (xlator_t *this) goto out; } - conf->rpc = rpc_clnt_init (&conf->rpc_conf, this->options, this->ctx, + conf->rpc = rpc_clnt_new (&conf->rpc_conf, this->options, this->ctx, this->name); if (!conf->rpc) goto out; -- cgit