Code

frontend: Return an error if no handler threads could be created.
authorSebastian Harl <sh@tokkee.org>
Fri, 20 Dec 2013 08:09:59 +0000 (09:09 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 20 Dec 2013 08:09:59 +0000 (09:09 +0100)
src/frontend/sock.c

index 24708db5ca2bb0e6e5dcc61e5c384fe1a03148ff..b5a3dcdd6a2082af6f0b6ab0a75e23fb9a9b99dc 100644 (file)
@@ -497,7 +497,7 @@ sdb_fe_sock_listen_and_serve(sdb_fe_socket_t *sock, sdb_fe_loop_t *loop)
                }
        }
 
-       while (loop->do_loop) {
+       while (loop->do_loop && num_threads) {
                struct timeval timeout = { 1, 0 }; /* one second */
                sdb_llist_iter_t *iter;
 
@@ -559,6 +559,9 @@ sdb_fe_sock_listen_and_serve(sdb_fe_socket_t *sock, sdb_fe_loop_t *loop)
 
        sdb_channel_destroy(sock->chan);
        sock->chan = NULL;
+
+       if (! num_threads)
+               return -1;
        return 0;
 } /* sdb_fe_sock_listen_and_server */