Skip to content

Commit 7e930d9

Browse files
committed
set h && watcher if the connection succeeds immediately
1 parent 416d2e9 commit 7e930d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ static connection_state_t _sql_connection_init(void **h, connection_t *conn, voi
335335
PQdb(c->db), PQhost(c->db), PQserverVersion(c->db), PQprotocolVersion(c->db),
336336
PQbackendPID(c->db));
337337
PQsetnonblocking(c->db, 1);
338+
339+
*h = c;
340+
if (sql->config.connect_query) connection_add_watch_post(conn, CONNECTION_STATE_CONNECTED,
341+
_sql_connect_query_run, true, sql);
342+
338343
connection_signal_connected(c->conn);
339344
return CONNECTION_STATE_CONNECTING;
340345

0 commit comments

Comments
 (0)