Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
73ae8558
Commit
73ae8558
authored
Jul 11, 2013
by
antirez
Browse files
Sentinel: embed IPv6 address into [] when naming slave/sentinel instance.
parent
3fc7f324
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
73ae8558
...
@@ -835,7 +835,9 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char *
...
@@ -835,7 +835,9 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char *
/* For slaves and sentinel we use ip:port as name. */
/* For slaves and sentinel we use ip:port as name. */
if
(
flags
&
(
SRI_SLAVE
|
SRI_SENTINEL
))
{
if
(
flags
&
(
SRI_SLAVE
|
SRI_SENTINEL
))
{
snprintf
(
slavename
,
sizeof
(
slavename
),
"%s:%d"
,
hostname
,
port
);
snprintf
(
slavename
,
sizeof
(
slavename
),
strchr
(
hostname
,
':'
)
?
"[%s]:%d"
:
"%s:%d"
,
hostname
,
port
);
name
=
slavename
;
name
=
slavename
;
}
}
...
@@ -943,7 +945,9 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
...
@@ -943,7 +945,9 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
sentinelRedisInstance
*
slave
;
sentinelRedisInstance
*
slave
;
redisAssert
(
ri
->
flags
&
SRI_MASTER
);
redisAssert
(
ri
->
flags
&
SRI_MASTER
);
key
=
sdscatprintf
(
sdsempty
(),
"%s:%d"
,
ip
,
port
);
key
=
sdscatprintf
(
sdsempty
(),
strchr
(
ip
,
':'
)
?
"[%s]:%d"
:
"%s:%d"
,
ip
,
port
);
slave
=
dictFetchValue
(
ri
->
slaves
,
key
);
slave
=
dictFetchValue
(
ri
->
slaves
,
key
);
sdsfree
(
key
);
sdsfree
(
key
);
return
slave
;
return
slave
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment