Hi Chris,
I check out the latest CVS and tried, however the auto-failover still not
working. I changed the part of the code to make it work, explicitly
release a sql
socket when a query fail, and get a new socket b4 every query execution.
I wonder will this cause any performance issues, need your experty on
this.
Below is a portion of the rlm_sql.c code that I customized: (I append "change" at each
line I
customized")
case PW_STATUS_START:
if(sql_set_user(inst, request, sqlusername, 0) < 0)
return RLM_MODULE_FAIL;
radius_xlat(querystr, MAX_QUERY_LEN, inst->config->accounting_start_query,
request, NULL);
query_log(inst, querystr);
sqlsocket = sql_get_socket(inst);
if (sqlsocket == NULL)
return(RLM_MODULE_FAIL); //change
if (querystr) {
if ((inst->module->sql_query)(sqlsocket, inst->config, querystr) < 0) {
radlog(L_ERR, "rlm_sql: Couldn't update SQL accounting" " for START
packet - %s", (char *)(inst->module->sql_error)(sqlsocket, inst->config));
(inst->module->sql_finish_query)(sqlsocket, inst->config);
//change
sql_release_socket(inst, sqlsocket);
//change
radius_xlat(querystr, MAX_QUERY_LEN,
inst->config->accounting_start_query_alt, request, NULL);
query_log(inst, querystr);
sqlsocket = sql_get_socket(inst);
//change
if (sqlsocket == NULL)
//change
return(RLM_MODULE_FAIL);
//change
if (querystr) {
if ((inst->module->sql_query)(sqlsocket, inst->config, querystr) < 0) {
radlog(L_ERR, "rlm_sql: Couldn't update SQL" "accounting START
record - %s", (char*)(inst->module->sql_error)(sqlsocket, inst->config));
(inst->module->sql_finish_query)(sqlsocket,
inst->config); //change
sql_release_socket(inst, sqlsocket);
//change
return(RLM_MODULE_FAIL);
//change
}
(inst->module->sql_finish_query)(sqlsocket,
inst->config);
}
}
(inst->module->sql_finish_query)(sqlsocket, inst->config);
}
break;
//end of code
thx
--
Cheers,
CM.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html