diff options
author | Amar Tumballi <amar@gluster.com> | 2009-08-20 18:51:10 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-08-20 19:05:16 -0700 |
commit | cb539b0b65d1868410a10266edb042bdaf867301 (patch) | |
tree | 4635c4b850d86e2d3995b3402ac354382f346bea /xlators | |
parent | 45883c74f2c3b11b77fa94be714341ccf0e21198 (diff) |
protocol/client: 'connecting' event is properly notified.
when there are no servers available to client, and transport init is
not successful, send 'connecting' event once to parent so it doesn't
hand in there.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 224 (Client hangs if none of the servers are up)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=224
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 26 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-protocol.h | 1 |
2 files changed, 23 insertions, 4 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index b7f15a8df5f..af5a0bb15f2 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -5395,6 +5395,7 @@ int client_setvolume_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { + client_conf_t *conf = NULL; gf_mop_setvolume_rsp_t *rsp = NULL; client_connection_t *conn = NULL; glusterfs_ctx_t *ctx = NULL; @@ -5412,10 +5413,10 @@ client_setvolume_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, transport_t *peer_trans = NULL; uint64_t peer_trans_int = 0; - trans = frame->local; frame->local = NULL; this = frame->this; conn = trans->xl_private; + conf = this->private; rsp = gf_param (hdr); @@ -5509,7 +5510,9 @@ client_setvolume_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, } } + conf->connecting = 0; out: + if (-1 == op_ret) { /* Let the connection/re-connection happen in * background, for now, don't hang here, @@ -5521,6 +5524,7 @@ out: GF_EVENT_CHILD_CONNECTING, trans->xl); parent = parent->next; } + conf->connecting= 1; } STACK_DESTROY (frame->root); @@ -6105,7 +6109,6 @@ notify (xlator_t *this, int32_t event, void *data, ...) client_connection_t *conn = NULL; client_conf_t *conf = NULL; xlator_list_t *parent = NULL; - conf = this->private; trans = data; @@ -6129,6 +6132,21 @@ notify (xlator_t *this, int32_t event, void *data, ...) ret = -1; protocol_client_cleanup (trans); + if (conf->connecting == 0) { + /* Let the connection/re-connection happen in + * background, for now, don't hang here, + * tell the parents that i am all ok.. + */ + parent = trans->xl->parents; + while (parent) { + parent->xlator->notify (parent->xlator, + GF_EVENT_CHILD_CONNECTING, + trans->xl); + parent = parent->next; + } + conf->connecting = 1; + } + was_not_down = 0; for (i = 0; i < CHANNEL_MAX; i++) { conn = conf->transport[i]->xl_private; @@ -6150,10 +6168,10 @@ notify (xlator_t *this, int32_t event, void *data, ...) if (conn->connected == 1) child_down = 0; } - + if (child_down && was_not_down) { gf_log (this->name, GF_LOG_INFO, "disconnected"); - + protocol_client_mark_fd_bad (this); parent = this->parents; diff --git a/xlators/protocol/client/src/client-protocol.h b/xlators/protocol/client/src/client-protocol.h index aef58ae30b0..7249853a65a 100644 --- a/xlators/protocol/client/src/client-protocol.h +++ b/xlators/protocol/client/src/client-protocol.h @@ -82,6 +82,7 @@ struct _client_conf { struct timeval last_sent; struct timeval last_received; pthread_mutex_t mutex; + int connecting; }; typedef struct _client_conf client_conf_t; |