Merge pull request #89 from frenche/listen_once

GUAC-1361: listen() need not be present in main loop
This commit is contained in:
Mike Jumper 2015-11-02 11:56:00 -08:00
commit f9cc90307b

View File

@ -666,17 +666,17 @@ int main(int argc, char* argv[]) {
/* Free addresses */ /* Free addresses */
freeaddrinfo(addresses); freeaddrinfo(addresses);
/* Daemon loop */
for (;;) {
pid_t child_pid;
/* Listen for connections */ /* Listen for connections */
if (listen(socket_fd, 5) < 0) { if (listen(socket_fd, 5) < 0) {
guacd_log(GUAC_LOG_ERROR, "Could not listen on socket: %s", strerror(errno)); guacd_log(GUAC_LOG_ERROR, "Could not listen on socket: %s", strerror(errno));
return 3; return 3;
} }
/* Daemon loop */
for (;;) {
pid_t child_pid;
/* Accept connection */ /* Accept connection */
client_addr_len = sizeof(client_addr); client_addr_len = sizeof(client_addr);
connected_socket_fd = accept(socket_fd, connected_socket_fd = accept(socket_fd,