Skip to content

Commit

Permalink
CLUSTER MEET: better error messages when address is invalid.
Browse files Browse the repository at this point in the history
Fixes issue redis#1734.
  • Loading branch information
antirez committed May 9, 2014
1 parent 74435ab commit 71d0e7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -3287,17 +3287,19 @@ void clusterCommand(redisClient *c) {
}

if (!strcasecmp(c->argv[1]->ptr,"meet") && c->argc == 4) {
long port;
long long port;

if (getLongFromObjectOrReply(c, c->argv[3], &port, NULL) != REDIS_OK) {
addReplyError(c,"Invalid TCP port specified");
if (getLongLongFromObject(c->argv[3], &port) != REDIS_OK) {
addReplyErrorFormat(c,"Invalid TCP port specified: %s",
(char*)c->argv[3]->ptr);
return;
}

if (clusterStartHandshake(c->argv[2]->ptr,port) == 0 &&
errno == EINVAL)
{
addReplyError(c,"Invalid node address specified");
addReplyErrorFormat(c,"Invalid node address specified: %s:%s",
(char*)c->argv[2]->ptr, (char*)c->argv[3]->ptr);
} else {
addReply(c,shared.ok);
}
Expand Down

0 comments on commit 71d0e7e

Please sign in to comment.