mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: session: simplify error path in session_accept_fd()
Now that this function is always called with an initialized connection and that the control layer is always initialized, we don't need to play games with fdtab[] to decide how to close, we can simply rely on the regular close path using conn_ctrl_close(), which can be fused with conn_xprt_close() into conn_full_close(). The code is cleaner because the FD is now used only for some protocol-specific setup (that will eventually have to move) and to try to send a hard-coded HTTP 500 error message on raw sockets.
This commit is contained in:
parent
83efc320aa
commit
01ca149047
@ -271,11 +271,8 @@ int session_accept_fd(struct connection *cli_conn)
|
|||||||
* done below, for all errors. */
|
* done below, for all errors. */
|
||||||
sess->listener = NULL;
|
sess->listener = NULL;
|
||||||
session_free(sess);
|
session_free(sess);
|
||||||
|
|
||||||
out_free_conn:
|
out_free_conn:
|
||||||
conn_stop_tracking(cli_conn);
|
|
||||||
conn_xprt_close(cli_conn);
|
|
||||||
conn_free(cli_conn);
|
|
||||||
listener_release(l);
|
|
||||||
if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) &&
|
if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) &&
|
||||||
p->mode == PR_MODE_HTTP && l->bind_conf->mux_proto == NULL) {
|
p->mode == PR_MODE_HTTP && l->bind_conf->mux_proto == NULL) {
|
||||||
/* critical error, no more memory, try to emit a 500 response */
|
/* critical error, no more memory, try to emit a 500 response */
|
||||||
@ -283,10 +280,10 @@ int session_accept_fd(struct connection *cli_conn)
|
|||||||
MSG_DONTWAIT|MSG_NOSIGNAL);
|
MSG_DONTWAIT|MSG_NOSIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fdtab[cfd].owner)
|
conn_stop_tracking(cli_conn);
|
||||||
fd_delete(cfd);
|
conn_full_close(cli_conn);
|
||||||
else
|
conn_free(cli_conn);
|
||||||
close(cfd);
|
listener_release(l);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user