CLUSTER MEET: better error messages when address is invalid.

Fixes issue #1734.
This commit is contained in:
antirez 2014-05-09 16:36:59 +02:00
parent 74435aba47
commit 71d0e7e0ea

View File

@ -3287,17 +3287,19 @@ void clusterCommand(redisClient *c) {
} }
if (!strcasecmp(c->argv[1]->ptr,"meet") && c->argc == 4) { 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) { if (getLongLongFromObject(c->argv[3], &port) != REDIS_OK) {
addReplyError(c,"Invalid TCP port specified"); addReplyErrorFormat(c,"Invalid TCP port specified: %s",
(char*)c->argv[3]->ptr);
return; return;
} }
if (clusterStartHandshake(c->argv[2]->ptr,port) == 0 && if (clusterStartHandshake(c->argv[2]->ptr,port) == 0 &&
errno == EINVAL) 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 { } else {
addReply(c,shared.ok); addReply(c,shared.ok);
} }