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) {
...
@@ -226,7 +226,7 @@ void clusterSaveConfigOrDie(void) {
}
}
void
clusterInit
(
void
)
{
void
clusterInit
(
void
)
{
int saveconf = 0
, j
;
int
saveconf
=
0
;
server
.
cluster
=
zmalloc
(
sizeof
(
clusterState
));
server
.
cluster
=
zmalloc
(
sizeof
(
clusterState
));
server
.
cluster
->
myself
=
NULL
;
server
.
cluster
->
myself
=
NULL
;
...
@@ -252,25 +252,16 @@ void clusterInit(void) {
...
@@ -252,25 +252,16 @@ void clusterInit(void) {
saveconf
=
1
;
saveconf
=
1
;
}
}
if
(
saveconf
)
clusterSaveConfigOrDie
();
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
;
server
.
cfd_count
=
0
;
if (server.bindaddr_count == 0) server.bindaddr[0] = NULL;
if
(
listenToPort
(
server
.
port
+
REDIS_CLUSTER_PORT_INCR
,
for (j = 0; j < server.bindaddr_count || j == 0; j++) {
server
.
cfd
,
&
server
.
cfd_count
)
==
REDIS_ERR
)
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);
exit
(
1
);
exit
(
1
);
}
}
if (aeCreateFileEvent(server.el, server.cfd[j], AE_READABLE,
clusterAcceptHandler, NULL) == AE_ERR) redisPanic("Unrecoverable error creating Redis Cluster file event.");
/* The slots -> keys map is a sorted set. Init it. */
server.cfd_count++;
}
server
.
cluster
->
slots_to_keys
=
zslCreate
();
server
.
cluster
->
slots_to_keys
=
zslCreate
();
}
}
...
...
src/redis.h
View file @
81a6a963
...
@@ -1096,6 +1096,7 @@ int getClientLimitClassByName(char *name);
...
@@ -1096,6 +1096,7 @@ int getClientLimitClassByName(char *name);
char *getClientLimitClassName(int class);
char *getClientLimitClassName(int class);
void flushSlavesOutputBuffers(void);
void flushSlavesOutputBuffers(void);
void disconnectSlaves(void);
void disconnectSlaves(void);
int listenToPort(int port, int *fds, int *count);
#ifdef __GNUC__
#ifdef __GNUC__
void addReplyErrorFormat(redisClient *c, const char *fmt, ...)
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