BUG/MINOR: proto_reverse_connect: fix FD leak upon connect
new_reverse_conn() is creating its own socket with sock_create_server_socket(). However the connect is done with conn->ctrl->connect() which is tcp_connect_server(). tcp_connect_server() is also creating its own socket and sets it in the struct conn, left the previous socket unclosed and leaking at each attempt. This patch fixes the issue by letting tcp_connect_server() handling the socket part, and removes it in new_reverse_conn().
This commit is contained in:
parent
c58fd4d1cc
commit
c21ec3b735
|
@ -68,11 +68,6 @@ static struct connection *new_reverse_conn(struct listener *l, struct server *sr
|
|||
if (conn_prepare(conn, protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0), srv->xprt))
|
||||
goto err;
|
||||
|
||||
/* TODO simplification of tcp_connect_server() */
|
||||
conn->handle.fd = sock_create_server_socket(conn);
|
||||
if (fd_set_nonblock(conn->handle.fd) == -1)
|
||||
goto err;
|
||||
|
||||
if (conn->ctrl->connect(conn, 0) != SF_ERR_NONE)
|
||||
goto err;
|
||||
|
||||
|
|
Loading…
Reference in New Issue