BUG/MEDIUM: connection: don't leak the fd of an accepted connection
When session_accept_fd() fails in conn_prepare(), e.g. because the SSL
connection limit (maxsslconn) is reached, conn_ctrl_init() hasn't run yet
and CO_FL_CTRL_READY isn't set. conn_ctrl_close() then cannot close the fd,
leaving it open. Additional incoming connections on the same listener keep
accumulating leaked fds, even after the SSL connections are released, and
may ultimately exhaust maxsock, also preventing non-SSL frontends from
accepting.
Fix this by closing the fd in conn_ctrl_close() when it hasn't been
registered yet, unless the connection is fdless.
Many thanks to Adam Crawford for the report.
This should be backported to all supported versions.