summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-01-21 16:38:46 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2015-06-17 15:58:56 +0200
commit55bc82f07011c59058597ae0d894640820e94216 (patch)
treec79cf62ed6d525f2e893b7be6d07069808ffb036
parent939e643c2a014f973fd537b0420f8110ae13e856 (diff)
reds: increase listening socket backlog
With a TCP socket, the backlog doesn't seem to matter much, perhaps because of latency or underlying protocol behaviour. However, on UNIX socket, it is fairly easy to reach the backlog limit and the client will get an EAGAIN error (but not ECONNREFUSED as stated in listen(7)) that is not easy to deal with: attempting to reconnect in a loop might busy-loop forever as there are no guarantee the server will accept new connections, so it will be inherently racy. Typically, Spice server can easily have up to 15 concurrent incoming connections that are established during initialization of the session. To improve the situation, raise the backlog limit to the default maximum system value, which is 128 on Linux.
-rw-r--r--server/reds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/server/reds.c b/server/reds.c
index cc26ca7e..56e87a22 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2452,7 +2452,7 @@ static int reds_init_socket(const char *addr, int portnr, int family)
return -1;
listen:
- if (listen(slisten,1) != 0) {
+ if (listen(slisten, SOMAXCONN) != 0) {
spice_warning("listen: %s", strerror(errno));
close(slisten);
return -1;