Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 599b2efb rédigé par Kubat's avatar Kubat
Parcourir les fichiers

SRV: Add more logs to know what went wrong with the lkt_listen function

parent 72717dbc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!162Add a trie structure to get all the commands + various fixes
Pipeline #2243 en échec
......@@ -1159,7 +1159,8 @@ void
lkt_listen(struct lkt_state *srv)
{
int fds_max_config = 16; /* Default value */
assert(database_config_get(srv->db, "server", "max_clients", &fds_max_config));
if (!database_config_get(srv->db, "server", "max_clients", &fds_max_config))
LOG_FATAL("Failed to get the 'server:max_client' field from the configuration");
srv->fds_max = fds_max_config;
srv->fds = LKT_ALLOC_STRUCT_ARRAY(pollfd, srv->fds_max);
......@@ -1199,7 +1200,7 @@ lkt_listen(struct lkt_state *srv)
init_socket_func init_sock = is_unix_socket ? init_listening_socket_unix : init_listening_socket_net;
if ((srv->fds[0].fd = init_sock(srv->host, srv->port)) < 0)
return;
LOG_FATAL("Failed to init socket: %s:%s", srv->host, srv->port);
if (is_unix_socket)
init_permission_socket_unix(srv->host, perms);
......@@ -1213,10 +1214,16 @@ lkt_listen(struct lkt_state *srv)
/* Listen */
for (;;) {
handle_signals(srv);
if (handle_network_events(srv) < 0)
if (handle_network_events(srv) < 0) {
LOG_ERROR("LISTEN", "Failed to handle_network_events");
break;
if (handle_idle_events(srv) < 0)
}
if (handle_idle_events(srv) < 0) {
LOG_ERROR("LISTEN", "Failed to handle_idle_events");
break;
}
handle_queue_events(srv);
}
LOG_FATAL("Infinit event loop break, should not happen");
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter