]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: proto: make common fd checks in sock_create_server_socket
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 23 Apr 2024 21:37:43 +0000 (23:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Apr 2024 19:39:24 +0000 (21:39 +0200)
commitd3fc982cd788e8b244c974eefa8658d38e51c9ed
tree6ec068149f78b1ed9f87caf8962de6c61aa62763
parent772d070ab54a9a5c30bfb5d65178c4bbc978a61c
MEDIUM: proto: make common fd checks in sock_create_server_socket

quic_connect_server(), tcp_connect_server(), uxst_connect_server() duplicate
same code to check different ERRNOs, that socket() and setns() may return.
They also duplicate some runtime condition checks, applied to the obtained
server socket fd.

So, in order to remove these duplications and to improve code readability,
let's encapsulate socket() and setns() ERRNOs handling in
sock_handle_system_err(). It must be called just before fd's runtime condition
checks, which we also move in sock_create_server_socket by the same reason.
include/haproxy/sock.h
src/proto_quic.c
src/proto_tcp.c
src/proto_uxst.c
src/sock.c