mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[CLEANUP] accept: replace some inappropriate Alert() calls with send_log()
Some Alert() messages were remaining in the accept() path, which they would have no chance to be detected. Remove some of them (the impossible ones) and replace the relevant ones with send_log() so that the admin has a chance to catch them.
This commit is contained in:
parent
f099e7906d
commit
fffe1325df
@ -87,10 +87,9 @@ int frontend_accept(struct session *s)
|
||||
s->srv_error = default_srv_error;
|
||||
|
||||
/* Adjust some socket options */
|
||||
if ((s->listener->addr.ss_family != AF_UNIX) && unlikely(setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, (char *) &one, sizeof(one)) == -1)) {
|
||||
Alert("accept(): cannot set the socket in non blocking mode. Giving up\n");
|
||||
if ((s->listener->addr.ss_family != AF_UNIX) &&
|
||||
setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, (char *) &one, sizeof(one)) == -1)
|
||||
goto out_delete_cfd;
|
||||
}
|
||||
|
||||
if (s->fe->options & PR_O_TCP_CLI_KA)
|
||||
setsockopt(cfd, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(one));
|
||||
|
@ -57,10 +57,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
struct http_txn *txn;
|
||||
struct task *t;
|
||||
|
||||
if (unlikely((s = pool_alloc2(pool2_session)) == NULL)) {
|
||||
Alert("out of memory in event_accept().\n");
|
||||
if (unlikely((s = pool_alloc2(pool2_session)) == NULL))
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
/* minimum session initialization required for monitor mode below */
|
||||
s->flags = 0;
|
||||
@ -89,10 +87,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
LIST_ADDQ(&sessions, &s->list);
|
||||
LIST_INIT(&s->back_refs);
|
||||
|
||||
if (unlikely((t = task_new()) == NULL)) { /* disable this proxy for a while */
|
||||
Alert("out of memory in event_accept().\n");
|
||||
if (unlikely((t = task_new()) == NULL))
|
||||
goto out_free_session;
|
||||
}
|
||||
|
||||
s->term_trace = 0;
|
||||
s->cli_addr = *addr;
|
||||
@ -211,10 +207,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
s->store_count = 0;
|
||||
|
||||
/* Adjust some socket options */
|
||||
if (unlikely(fcntl(cfd, F_SETFL, O_NONBLOCK) == -1)) {
|
||||
Alert("accept(): cannot set the socket in non blocking mode. Giving up\n");
|
||||
if (unlikely(fcntl(cfd, F_SETFL, O_NONBLOCK) == -1))
|
||||
goto out_free_task;
|
||||
}
|
||||
|
||||
txn = &s->txn;
|
||||
/* Those variables will be checked and freed if non-NULL in
|
||||
|
@ -1188,7 +1188,9 @@ int stream_sock_accept(int fd)
|
||||
}
|
||||
|
||||
if (unlikely(cfd >= global.maxsock)) {
|
||||
Alert("accept(): not enough free sockets. Raise -n argument. Giving up.\n");
|
||||
send_log(p, LOG_EMERG,
|
||||
"Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n",
|
||||
p->id);
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user