summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client.c80
-rw-r--r--xlators/protocol/client/src/client.h2
2 files changed, 34 insertions, 48 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 74bf210..32d5e65 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1121,10 +1121,6 @@ is_client_rpc_init_command (dict_t *dict, xlator_t *this,
gf_boolean_t ret = _gf_false;
int dict_ret = -1;
- if (!strstr (this->name, "replace-brick")) {
- gf_msg_trace (this->name, 0, "name is !replace-brick");
- goto out;
- }
dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT, value);
if (dict_ret) {
gf_msg_trace (this->name, 0, "key %s not present",
@@ -1165,7 +1161,7 @@ out:
}
-static gf_boolean_t
+static int
client_set_remote_options (char *value, xlator_t *this)
{
char *dup_value = NULL;
@@ -1176,56 +1172,53 @@ client_set_remote_options (char *value, xlator_t *this)
char *remote_port_str = NULL;
char *tmp = NULL;
int remote_port = 0;
- gf_boolean_t ret = _gf_false;
+ int ret = 0;
dup_value = gf_strdup (value);
host = strtok_r (dup_value, ":", &tmp);
subvol = strtok_r (NULL, ":", &tmp);
remote_port_str = strtok_r (NULL, ":", &tmp);
- if (!subvol) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "proper value not passed as "
- "subvolume");
- goto out;
- }
-
- host_dup = gf_strdup (host);
- if (!host_dup) {
- goto out;
- }
-
- ret = dict_set_dynstr (this->options, "remote-host", host_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
+ if (host) {
+ host_dup = gf_strdup (host);
+ if (!host_dup) {
+ goto out;
+ }
+ ret = dict_set_dynstr (this->options, "remote-host", host_dup);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
+ }
}
- subvol_dup = gf_strdup (subvol);
- if (!subvol_dup) {
- goto out;
- }
+ if (subvol) {
+ subvol_dup = gf_strdup (subvol);
+ if (!subvol_dup) {
+ goto out;
+ }
- ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
+ ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
+ }
}
- remote_port = atoi (remote_port_str);
- GF_ASSERT (remote_port);
+ if (remote_port_str) {
+ remote_port = atoi (remote_port_str);
- ret = dict_set_int32 (this->options, "remote-port",
- remote_port);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-port to %d", remote_port);
- goto out;
+ ret = dict_set_int32 (this->options, "remote-port",
+ remote_port);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-port to %d", remote_port);
+ goto out;
+ }
}
- ret = _gf_true;
+ ret = 0;
out:
GF_FREE (dup_value);
@@ -1252,11 +1245,6 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
"client rpc init command");
ret = client_set_remote_options (value, this);
- if (ret) {
- (void) client_destroy_rpc (this);
- ret = client_init_rpc (this);
- }
-
if (!ret) {
op_ret = 0;
op_errno = 0;
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 207c778..b51607f 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -27,8 +27,6 @@
#include "client-messages.h"
/* FIXME: Needs to be defined in a common file */
-#define CLIENT_CMD_CONNECT "trusted.glusterfs.client-connect"
-#define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect"
#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump"
#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB)
#define GF_MIN_SOCKET_WINDOW_SIZE (0)