failover to any active transport when requested channel is not connected

Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
This commit is contained in:
Anand V. Avati 2009-03-10 00:27:52 +05:30
parent ae378b63c0
commit 2323b92d9b
2 changed files with 30 additions and 2 deletions

View File

@ -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)
{

View File

@ -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;