mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
FS-5832 additional hostname updates for failover behavior
This commit is contained in:
parent
85844e5792
commit
f0e8eb2a5e
@ -1882,7 +1882,8 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
|
|||||||
} else if (!strcasecmp(argv[0], "del")) {
|
} else if (!strcasecmp(argv[0], "del")) {
|
||||||
char *what = argv[1];
|
char *what = argv[1];
|
||||||
if (!strcasecmp(what, "*")) {
|
if (!strcasecmp(what, "*")) {
|
||||||
switch_core_sql_exec("delete from complete");
|
mystream.write_function(&mystream, "delete from complete where hostname='%s'", switch_core_get_hostname());
|
||||||
|
switch_core_sql_exec(mystream.data);
|
||||||
} else {
|
} else {
|
||||||
mystream.write_function(&mystream, "delete from complete where ");
|
mystream.write_function(&mystream, "delete from complete where ");
|
||||||
for (x = 0; x < argc - 1; x++) {
|
for (x = 0; x < argc - 1; x++) {
|
||||||
|
@ -2317,7 +2317,7 @@ static void core_event_handler(switch_event_t *event)
|
|||||||
new_sql() = switch_mprintf("delete from channels where hostname='%q';"
|
new_sql() = switch_mprintf("delete from channels where hostname='%q';"
|
||||||
"delete from interfaces where hostname='%q';"
|
"delete from interfaces where hostname='%q';"
|
||||||
"delete from calls where hostname='%q'",
|
"delete from calls where hostname='%q'",
|
||||||
switch_core_get_switchname(), switch_core_get_switchname(), switch_core_get_switchname()
|
switch_core_get_switchname(), switch_core_get_hostname(), switch_core_get_switchname()
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case SWITCH_EVENT_LOG:
|
case SWITCH_EVENT_LOG:
|
||||||
@ -3106,7 +3106,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
|||||||
case SCDB_TYPE_ODBC:
|
case SCDB_TYPE_ODBC:
|
||||||
if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
|
if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
|
||||||
char sql[512] = "";
|
char sql[512] = "";
|
||||||
char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL };
|
char *tables[] = { "channels", "calls", "tasks", NULL };
|
||||||
int i;
|
int i;
|
||||||
const char *hostname = switch_core_get_switchname();
|
const char *hostname = switch_core_get_switchname();
|
||||||
|
|
||||||
@ -3265,8 +3265,18 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) {
|
||||||
|
char sql[512] = "";
|
||||||
|
char *tables[] = { "complete", "interfaces", NULL };
|
||||||
|
int i;
|
||||||
|
const char *hostname = switch_core_get_hostname();
|
||||||
|
|
||||||
|
for (i = 0; tables[i]; i++) {
|
||||||
|
switch_snprintfv(sql, sizeof(sql), "delete from %q where hostname='%q'", tables[i], hostname);
|
||||||
|
switch_cache_db_execute_sql(sql_manager.dbh, sql, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch_cache_db_execute_sql(sql_manager.dbh, "delete from complete where sticky=0", NULL);
|
|
||||||
switch_cache_db_execute_sql(sql_manager.dbh, "delete from aliases where sticky=0", NULL);
|
switch_cache_db_execute_sql(sql_manager.dbh, "delete from aliases where sticky=0", NULL);
|
||||||
switch_cache_db_execute_sql(sql_manager.dbh, "delete from nat where sticky=0", NULL);
|
switch_cache_db_execute_sql(sql_manager.dbh, "delete from nat where sticky=0", NULL);
|
||||||
switch_cache_db_execute_sql(sql_manager.dbh, "create index alias1 on aliases (alias)", NULL);
|
switch_cache_db_execute_sql(sql_manager.dbh, "create index alias1 on aliases (alias)", NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user