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
81a6a963
Commit
81a6a963
authored
Aug 22, 2013
by
antirez
Browse files
Use listenToPort() in cluster.c as well.
parent
4f310e05
Changes
2
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
81a6a963
...
...
@@ -226,7 +226,7 @@ void clusterSaveConfigOrDie(void) {
}
void clusterInit(void) {
int saveconf = 0
, j
;
int saveconf = 0;
server.cluster = zmalloc(sizeof(clusterState));
server.cluster->myself = NULL;
...
...
@@ -252,25 +252,16 @@ void clusterInit(void) {
saveconf = 1;
}
if (saveconf) clusterSaveConfigOrDie();
/* We need a listening TCP port for our cluster messaging needs */
/* We need a listening TCP port for our cluster messaging needs. */
server.cfd_count = 0;
if (server.bindaddr_count == 0) server.bindaddr[0] = NULL;
for (j = 0; j < server.bindaddr_count || j == 0; j++) {
server.cfd[j] = anetTcpServer(
server.neterr, server.port+REDIS_CLUSTER_PORT_INCR,
server.bindaddr[j]);
if (server.cfd[j] == -1) {
redisLog(REDIS_WARNING,
"Opening cluster listening TCP socket %s:%d: %s",
server.bindaddr[j] ? server.bindaddr[j] : "*",
server.port+REDIS_CLUSTER_PORT_INCR,
server.neterr);
if (listenToPort(server.port+REDIS_CLUSTER_PORT_INCR,
server.cfd,&server.cfd_count) == REDIS_ERR)
{
exit(1);
}
if (aeCreateFileEvent(server.el, server.cfd[j], AE_READABLE,
clusterAcceptHandler, NULL) == AE_ERR) redisPanic("Unrecoverable error creating Redis Cluster file event.");
server.cfd_count++;
}
/* The slots -> keys map is a sorted set. Init it. */
server.cluster->slots_to_keys = zslCreate();
}
...
...
src/redis.h
View file @
81a6a963
...
...
@@ -1096,6 +1096,7 @@ int getClientLimitClassByName(char *name);
char
*
getClientLimitClassName
(
int
class
);
void
flushSlavesOutputBuffers
(
void
);
void
disconnectSlaves
(
void
);
int
listenToPort
(
int
port
,
int
*
fds
,
int
*
count
);
#ifdef __GNUC__
void
addReplyErrorFormat
(
redisClient
*
c
,
const
char
*
fmt
,
...)
...
...
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