Miquel van Smoorenburg [[EMAIL PROTECTED]] wrote:
Hi All!
> >> I have two ideas, one a cron job to send the HUP during the slow hours. Two
> >> edit the code to send the HUP when the SQL backend drops. Does this sound
> >> logical?
> >
> The former should be fixed in the SQL code, the latter should be
> implemented server-wide so that for example the replication code
> can use it as well.
>
In my own programm (PostgreSQL driver) I use next code:
db_exec(query) {
...
if ( PQstatus(conn) == CONNECTION_BAD ) {
db_connect();
}
...
void db_connect()
{
...
if ( conn != NULL ) PQfinish(conn);
for (;;) {
conn = PQsetdbLogin(dbhost, NULL, NULL, NULL, dbname, dbuser, dbpass);
if ( PQstatus(conn) == CONNECTION_BAD ) {
conn = NULL;
elog(LOG_ERR, "Can't connect to database %s (%s@%s)",
dbname, dbuser, dbhost);
sleep(10);
} else return;
}
...
Working fine, when my backend lost connection.
(Database chashes or other...)
Best wishes, Mag
--
Nikolay P. Romanyuk
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html