From 1a94c7b68ff941b59b4eff502d02836df9176f13 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 1 Dec 2014 12:49:23 +0800 Subject: [PATCH] enlarge backlog number --- src/server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index 14d34e41..9338f8cf 100644 --- a/src/server.c +++ b/src/server.c @@ -64,6 +64,10 @@ #define BUF_SIZE 2048 #endif +#ifndef SSMAXCONN +#define SSMAXCONN 1024 +#endif + static void signal_cb(EV_P_ ev_signal *w, int revents); static void accept_cb(EV_P_ ev_io *w, int revents); static void server_recv_cb(EV_P_ ev_io *w, int revents); @@ -1088,7 +1092,7 @@ int main(int argc, char **argv) if (listenfd < 0) { FATAL("bind() error.."); } - if (listen(listenfd, SOMAXCONN) == -1) { + if (listen(listenfd, SSMAXCONN) == -1) { FATAL("listen() error."); } setnonblocking(listenfd);