summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnand V. Avati <avati@amp.gluster.com>2009-03-10 00:27:52 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-03-10 00:33:58 +0530
commit2323b92d9b7b679c84cab64697fc715434e28ac9 (patch)
tree996935179df8afe0747b34295e47091d54ec0eaf /xlators
parentae378b63c0ae93d8077d250de6a035b92bac8697 (diff)
failover to any active transport when requested channel is not connected
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-protocol.c28
-rw-r--r--xlators/protocol/client/src/client-protocol.h4
2 files changed, 30 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index 2a636a18fef..95a5db89590 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -61,6 +61,34 @@ static gf_op_t gf_mops[];
static gf_op_t gf_cbks[];
+transport_t *
+client_channel (xlator_t *this, int id)
+{
+ transport_t *trans = NULL;
+ client_conf_t *conf = NULL;
+ int i = 0;
+ struct client_connection *conn = NULL;
+
+ conf = this->private;
+
+ trans = conf->transport[id];
+ conn = trans->xl_private;
+
+ if (conn->connected == 1)
+ goto ret;
+
+ for (i = 0; i < CHANNEL_MAX; i++) {
+ trans = conf->transport[i];
+ conn = trans->xl_private;
+ if (conn->connected == 1)
+ break;
+ }
+
+ret:
+ return trans;
+}
+
+
static ino_t
this_ino_get_from_inode (inode_t *inode, xlator_t *this)
{
diff --git a/xlators/protocol/client/src/client-protocol.h b/xlators/protocol/client/src/client-protocol.h
index 513267d3783..ce8cd516953 100644
--- a/xlators/protocol/client/src/client-protocol.h
+++ b/xlators/protocol/client/src/client-protocol.h
@@ -54,8 +54,8 @@ enum {
CHANNEL_LOWLAT = 1,
CHANNEL_MAX
};
-#define CLIENT_CHANNEL(xl,id) \
- (((client_conf_t *)(xl->private))->transport[id])
+
+#define CLIENT_CHANNEL client_channel
struct client_connection;
typedef struct client_connection client_connection_t;