Constant replaced with macro MODES_NET_SERVICES_NUM.

This commit is contained in:
antirez 2013-12-14 22:38:39 +01:00
parent 38ed7698b3
commit eec5a6989f

View File

@ -1894,12 +1894,13 @@ void snipMode(int level) {
*/
/* Networking "stack" initialization. */
#define MODES_NET_SERVICES_NUM 4
void modesInitNet(void) {
struct {
char *descr;
int *socket;
int port;
} services[4] = {
} services[MODES_NET_SERVICES_NUM] = {
{"Raw TCP output", &Modes.ros, Modes.net_output_raw_port},
{"Raw TCP input", &Modes.ris, Modes.net_input_raw_port},
{"HTTP server", &Modes.https, Modes.net_http_port},
@ -1910,7 +1911,7 @@ void modesInitNet(void) {
memset(Modes.clients,0,sizeof(Modes.clients));
Modes.maxfd = -1;
for (j = 0; j < 4; j++) {
for (j = 0; j < MODES_NET_SERVICES_NUM; j++) {
int s = anetTcpServer(Modes.aneterr, services[j].port, NULL);
if (s == -1) {
fprintf(stderr, "Error opening the listening port %d (%s): %s\n",