[Spice-commits] server/reds.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Wed Jun 17 07:01:36 PDT 2015


 server/reds.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 55bc82f07011c59058597ae0d894640820e94216
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Jan 21 16:38:46 2015 +0100

    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.

diff --git a/server/reds.c b/server/reds.c
index cc26ca7..56e87a2 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;


More information about the Spice-commits mailing list