Skip to content

Commit

Permalink
Moved listend out of the loop -- we only need to do it once, it's acc…
Browse files Browse the repository at this point in the history
…ept that blocks for incoming connections.
  • Loading branch information
gpjt committed Aug 14, 2013
1 parent ea4876b commit f214f5a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/rsp.c
Expand Up @@ -138,11 +138,10 @@ int main(int argc, char *argv[]) {

freeaddrinfo(addrs);

listen(server_socket_fd, MAX_LISTEN_BACKLOG);
printf("Started. Listening on port %s.\n", server_port_str);

while (1) {
listen(server_socket_fd, MAX_LISTEN_BACKLOG);

client_socket_fd = accept(server_socket_fd, NULL, NULL);
if (client_socket_fd == -1) {
perror("Could not accept");
Expand Down

0 comments on commit f214f5a

Please sign in to comment.