]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "add and use automatic re-init on connection failure"
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 6 Oct 2025 22:55:48 +0000 (16:55 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 6 Oct 2025 22:56:45 +0000 (16:56 -0600)
This reverts commit c141294c8e13171f99a8b8c510f2df68d0b03b8c.

It's not clear why this commit was necessary, and it caused the MySQL code to leak file descriptors when a connection could not be established to the MySQL server.

src/lib/server/connection.c
src/lib/server/connection.h
src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c
src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c

index 76b8ab22a475b877e10095632e9c5bdb0e503a31..bf5f78944ac67a383c49da8313f026a5edb6e788 100644 (file)
@@ -1443,14 +1443,6 @@ int connection_signal_on_fd(connection_t *conn, int fd)
        return 0;
 }
 
-/** Tell a failed connection to move to CONNECTION_STATE_INIT
- *
- */
-connection_state_t connection_failed_reinit(UNUSED void *handle, UNUSED connection_state_t state, UNUSED void *uctx)
-{
-       return CONNECTION_STATE_INIT;
-}
-
 /** Close a connection if it's freed
  *
  * @param[in] conn to free.
index d7d33eca1edf999d396a2990bd21da9a70a5c11e..8bf24101eea075f47004b512555f0a217d6ffe7a 100644 (file)
@@ -269,8 +269,6 @@ void                        connection_signals_resume(connection_t *conn);
  * @{
  */
 int                    connection_signal_on_fd(connection_t *conn, int fd);
-
-connection_state_t     connection_failed_reinit(void *handle, connection_state_t state, void *uctx);
 /** @} */
 
 /** @name Allocate a new connection
index 963dea6d03a7712f3b6febcbe5bc33eb3fde35fb..dcbee041d0d47c0dffd5493961e8dc981e61029f 100644 (file)
@@ -1114,7 +1114,6 @@ static void *sql_escape_arg_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, void *uc
        conn = connection_alloc(ctx, el,
                                    &(connection_funcs_t){
                                        .init = _sql_connection_init,
-                                       .failed = connection_failed_reinit,
                                        .close = _sql_connection_close,
                                    },
                                    inst->config.trunk_conf.conn_conf,
index c6610a44a96c44142ba97195a349bbcc1c9896d8..2264a0872db8c106d9a9cd110b31ee83af786fe7 100644 (file)
@@ -853,7 +853,6 @@ static void *sql_escape_arg_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, void *uc
        conn = connection_alloc(ctx, el,
                                &(connection_funcs_t){
                                        .init = _sql_connection_init,
-                                       .failed = connection_failed_reinit,
                                        .close = _sql_connection_close,
                                },
                                inst->config.trunk_conf.conn_conf,