Commit d15e1e09 authored by Max Kellermann's avatar Max Kellermann

client: return early in client_new()

This saves one level of indent.
parent c0197c58
...@@ -237,6 +237,7 @@ static void client_close(struct client *client) ...@@ -237,6 +237,7 @@ static void client_close(struct client *client)
void client_new(int fd, const struct sockaddr *addr) void client_new(int fd, const struct sockaddr *addr)
{ {
unsigned int i; unsigned int i;
const char *hostname;
for (i = 0; i < client_max_connections for (i = 0; i < client_max_connections
&& clients[i].fd >= 0; i++) /* nothing */ ; && clients[i].fd >= 0; i++) /* nothing */ ;
...@@ -244,8 +245,9 @@ void client_new(int fd, const struct sockaddr *addr) ...@@ -244,8 +245,9 @@ void client_new(int fd, const struct sockaddr *addr)
if (i == client_max_connections) { if (i == client_max_connections) {
ERROR("Max Connections Reached!\n"); ERROR("Max Connections Reached!\n");
xclose(fd); xclose(fd);
} else { return;
const char *hostname; }
switch (addr->sa_family) { switch (addr->sa_family) {
#ifdef HAVE_TCP #ifdef HAVE_TCP
case AF_INET: case AF_INET:
...@@ -281,7 +283,6 @@ void client_new(int fd, const struct sockaddr *addr) ...@@ -281,7 +283,6 @@ void client_new(int fd, const struct sockaddr *addr)
} }
SECURE("client %i: opened from %s\n", i, hostname); SECURE("client %i: opened from %s\n", i, hostname);
client_init(&(clients[i]), fd); client_init(&(clients[i]), fd);
}
} }
static int client_process_line(struct client *client) static int client_process_line(struct client *client)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment