summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 2a636a18f..95a5db895 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 513267d37..ce8cd5169 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;