Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a11f4e4f
提交
a11f4e4f
authored
8月 04, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add auto-create-schemas param to switch.conf.xml
上级
0ec9ffe6
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
131 行增加
和
270 行删除
+131
-270
switch_types.h
src/include/switch_types.h
+2
-1
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+108
-265
switch_core.c
src/switch_core.c
+12
-4
switch_core_db.c
src/switch_core_db.c
+5
-0
switch_core_sqldb.c
src/switch_core_sqldb.c
+4
-0
没有找到文件。
src/include/switch_types.h
浏览文件 @
a11f4e4f
...
...
@@ -252,7 +252,8 @@ typedef enum {
SCF_USE_HEAVY_TIMING
=
(
1
<<
9
),
SCF_USE_CLOCK_RT
=
(
1
<<
10
),
SCF_VERBOSE_EVENTS
=
(
1
<<
11
),
SCF_USE_WIN32_MONOTONIC
=
(
1
<<
12
)
SCF_USE_WIN32_MONOTONIC
=
(
1
<<
12
),
SCF_AUTO_SCHEMAS
=
(
1
<<
13
)
}
switch_core_flag_enum_t
;
typedef
uint32_t
switch_core_flag_t
;
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
a11f4e4f
...
...
@@ -36,6 +36,8 @@
#include "mod_sofia.h"
#include <switch_stun.h>
switch_cache_db_handle_t
*
sofia_glue_get_db_handle
(
sofia_profile_t
*
profile
);
void
sofia_glue_set_image_sdp
(
private_object_t
*
tech_pvt
,
switch_t38_options_t
*
t38_options
,
int
insist
)
{
...
...
@@ -4683,8 +4685,6 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess
int
sofia_glue_init_sql
(
sofia_profile_t
*
profile
)
{
char
*
test_sql
=
NULL
;
switch_core_db_t
*
db
=
NULL
;
switch_odbc_handle_t
*
odbc_dbh
=
NULL
;
char
reg_sql
[]
=
"CREATE TABLE sip_registrations (
\n
"
...
...
@@ -4813,7 +4813,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
" expires INTEGER
\n
"
");
\n
"
;
if
(
switch_odbc_available
()
&&
profile
->
odbc_dsn
)
{
int
x
;
char
*
indexes
[]
=
{
"create index sr_call_id on sip_registrations (call_id)"
,
...
...
@@ -4867,18 +4867,12 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
NULL
};
switch_cache_db_handle_t
*
dbh
=
sofia_glue_get_db_handle
(
profile
);
if
(
!
(
odbc_dbh
=
switch_odbc_handle_new
(
profile
->
odbc_dsn
,
profile
->
odbc_user
,
profile
->
odbc_pass
)))
{
return
0
;
}
if
(
switch_odbc_handle_connect
(
odbc_dbh
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error Connecting ODBC DSN: %s
\n
"
,
profile
->
odbc_dsn
);
switch_odbc_handle_destroy
(
&
odbc_dbh
);
if
(
!
dbh
)
{
return
0
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Connected ODBC DSN: %s
\n
"
,
profile
->
odbc_dsn
);
test_sql
=
switch_mprintf
(
"delete from sip_registrations where (contact like '%%TCP%%' "
"or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
...
...
@@ -4886,16 +4880,14 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
"like '%%' and mwi_user like '%%' and mwi_host like '%%' "
"and orig_server_host like '%%' and orig_hostname like '%%'"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_registrations"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
reg_sql
,
NULL
,
NULL
);
}
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"drop table sip_registrations"
,
reg_sql
);
if
(
sofia_test_pflag
(
profile
,
PFLAG_SQL_IN_TRANS
))
{
char
*
test2
=
switch_mprintf
(
"%s;%s"
,
test_sql
,
test_sql
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test2
,
NULL
,
NULL
)
!=
SWITCH_ODBC
_SUCCESS
)
{
if
(
switch_cache_db_execute_sql
(
dbh
,
test2
,
NULL
)
!=
SWITCH_STATUS
_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"GREAT SCOTT!!! Cannot execute batched statements!
\n
"
"If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS
\n
"
);
sofia_clear_pflag
(
profile
,
PFLAG_SQL_IN_TRANS
);
...
...
@@ -4909,199 +4901,50 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
test_sql
=
switch_mprintf
(
"delete from sip_subscriptions where hostname='%q' and network_ip like '%%' and network_port like '%%'"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_subscriptions"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
sub_sql
,
NULL
,
NULL
);
}
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_subscriptions"
,
sub_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_dialogs where hostname='%q' and expires <> -9999 or rpid=''"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_dialogs"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
dialog_sql
,
NULL
,
NULL
);
}
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_dialogs"
,
dialog_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_presence where hostname='%q' or open_closed=''"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_presence"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
pres_sql
,
NULL
,
NULL
);
}
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_presence"
,
pres_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_authentication where hostname='%q' or last_nc >= 0"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_authentication"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
auth_sql
,
NULL
,
NULL
);
}
free
(
test_sql
);
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_authentication"
,
auth_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q' and network_ip like '%%'"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_shared_appearance_subscriptions"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
shared_appearance_sql
,
NULL
,
NULL
);
}
free
(
test_sql
);
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_shared_appearance_subscriptions"
,
shared_appearance_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q' and network_ip like '%%'"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_shared_appearance_dialogs"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
shared_appearance_dialogs_sql
,
NULL
,
NULL
);
}
free
(
test_sql
);
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_shared_appearance_dialogs"
,
shared_appearance_dialogs_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"select count(profile_name) from sip_recovery where hostname='%q'"
,
mod_sofia_globals
.
hostname
);
if
(
switch_odbc_handle_exec
(
odbc_dbh
,
test_sql
,
NULL
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
"DROP TABLE sip_recovery"
,
NULL
,
NULL
);
switch_odbc_handle_exec
(
odbc_dbh
,
recovery_sql
,
NULL
,
NULL
);
}
switch_cache_db_test_reactive
(
dbh
,
test_sql
,
"DROP TABLE sip_recovery"
,
recovery_sql
);
free
(
test_sql
);
for
(
x
=
0
;
indexes
[
x
];
x
++
)
{
switch_odbc_handle_exec
(
odbc_dbh
,
indexes
[
x
],
NULL
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
indexes
[
x
]
,
NULL
);
}
switch_cache_db_release_db_handle
(
&
dbh
);
}
else
if
(
profile
->
odbc_dsn
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"ODBC IS NOT AVAILABLE!
\n
"
);
}
else
{
if
(
!
(
db
=
switch_core_db_open_file
(
profile
->
dbname
)))
{
return
0
;
}
test_sql
=
switch_mprintf
(
"delete from sip_registrations where (contact like '%%TCP%%' "
"or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
"and network_ip like '%%' and network_port like '%%' and sip_username "
"like '%%' and mwi_user like '%%' and mwi_host like '%%' "
"and orig_server_host like '%%' and orig_hostname like '%%'"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_registrations"
,
reg_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_subscriptions where hostname='%q' and network_ip like '%%' or network_port like '%%'"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_subscriptions"
,
sub_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_dialogs where hostname='%q' and expires <> -9999 or rpid=''"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_dialogs"
,
dialog_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_presence where hostname='%q' or open_closed=''"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_presence"
,
pres_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_authentication where hostname='%q' or last_nc >= 0"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_authentication"
,
auth_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q' and network_ip like '%%'"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_shared_appearance_subscriptions"
,
shared_appearance_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q' and network_ip like '%%'"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_shared_appearance_dialogs"
,
shared_appearance_dialogs_sql
);
free
(
test_sql
);
test_sql
=
switch_mprintf
(
"select count(profile_name) from sip_recovery where hostname='%q'"
,
mod_sofia_globals
.
hostname
);
switch_core_db_test_reactive
(
db
,
test_sql
,
"DROP TABLE sip_recovery"
,
recovery_sql
);
free
(
test_sql
);
switch_core_db_exec
(
db
,
"create index if not exists ssa_hostname on sip_shared_appearance_subscriptions (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssa_aor on sip_shared_appearance_subscriptions (aor)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_profile_name on sip_shared_appearance_dialogs (profile_name)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_network_ip on sip_shared_appearance_dialogs (network_ip)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ssd_expires on sip_shared_appearance_dialogs (expires)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_call_id on sip_registrations (call_id)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_sip_user on sip_registrations (sip_user)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_sip_host on sip_registrations (sip_host)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_profile_name on sip_registrations (profile_name)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_presence_hosts on sip_registrations (presence_hosts)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_contact on sip_registrations (contact)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_expires on sip_registrations (expires)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_hostname on sip_registrations (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_status on sip_registrations (status)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_network_ip on sip_registrations (network_ip)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_network_port on sip_registrations (network_port)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_sip_username on sip_registrations (sip_username)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_sip_realm on sip_registrations (sip_realm)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_orig_server_host on sip_registrations (orig_server_host)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_orig_hostname on sip_registrations (orig_hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_call_id on sip_subscriptions (call_id)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_hostname on sip_subscriptions (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_network_ip on sip_subscriptions (network_ip)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_sip_user on sip_subscriptions (sip_user)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_sip_host on sip_subscriptions (sip_host)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_presence_hosts on sip_subscriptions (presence_hosts)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_event on sip_subscriptions (event)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_proto on sip_subscriptions (proto)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_sub_to_user on sip_subscriptions (sub_to_user)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists ss_sub_to_host on sip_subscriptions (sub_to_host)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_uuid on sip_dialogs (uuid)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_hostname on sip_dialogs (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_contact on sip_dialogs (contact)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_presence_id on sip_dialogs (presence_id)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_presence_data on sip_dialogs (presence_data)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_call_info on sip_dialogs (call_info)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_call_info_state on sip_dialogs (call_info_state)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sd_expires on sip_dialogs (expires)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sp_hostname on sip_presence (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sa_nonce on sip_authentication (nonce)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sa_hostname on sip_authentication (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_1 on sip_recovery (runtime_uuid)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_2 on sip_recovery (profile_name)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_3 on sip_recovery (hostname)"
,
NULL
,
NULL
,
NULL
);
switch_core_db_exec
(
db
,
"create index if not exists sr_4 on sip_recovery (uuid)"
,
NULL
,
NULL
,
NULL
);
}
if
(
odbc_dbh
)
{
switch_odbc_handle_destroy
(
&
odbc_dbh
);
return
1
;
}
if
(
db
)
{
switch_core_db_close
(
db
);
return
1
;
}
return
0
;
}
...
...
src/switch_core.c
浏览文件 @
a11f4e4f
...
...
@@ -1227,6 +1227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime
.
dummy_cng_frame
.
datalen
=
sizeof
(
runtime
.
dummy_data
);
runtime
.
dummy_cng_frame
.
buflen
=
sizeof
(
runtime
.
dummy_data
);
switch_set_flag
((
&
runtime
.
dummy_cng_frame
),
SFF_CNG
);
switch_set_flag
((
&
runtime
),
SCF_AUTO_SCHEMAS
);
switch_set_flag
((
&
runtime
),
SCF_NO_NEW_SESSIONS
);
runtime
.
hard_log_level
=
SWITCH_LOG_DEBUG
;
...
...
@@ -1261,9 +1262,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_dir_make_recursive
(
SWITCH_GLOBAL_dirs
.
sounds_dir
,
SWITCH_DEFAULT_DIR_PERMS
,
runtime
.
memory_pool
);
switch_dir_make_recursive
(
SWITCH_GLOBAL_dirs
.
temp_dir
,
SWITCH_DEFAULT_DIR_PERMS
,
runtime
.
memory_pool
);
switch_mutex_init
(
&
runtime
.
uuid_mutex
,
SWITCH_MUTEX_NESTED
,
runtime
.
memory_pool
);
switch_mutex_init
(
&
runtime
.
throttle_mutex
,
SWITCH_MUTEX_NESTED
,
runtime
.
memory_pool
);
switch_mutex_init
(
&
runtime
.
session_hash_mutex
,
SWITCH_MUTEX_NESTED
,
runtime
.
memory_pool
);
switch_mutex_init
(
&
runtime
.
global_mutex
,
SWITCH_MUTEX_NESTED
,
runtime
.
memory_pool
);
switch_mutex_init
(
&
runtime
.
global_var_mutex
,
SWITCH_MUTEX_NESTED
,
runtime
.
memory_pool
);
...
...
@@ -1272,7 +1275,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_event_create_plain
(
&
runtime
.
global_vars
,
SWITCH_EVENT_CHANNEL_DATA
);
switch_core_hash_init
(
&
runtime
.
mime_types
,
runtime
.
memory_pool
);
load_mime_types
();
runtime
.
flags
=
flags
;
runtime
.
flags
|
=
flags
;
runtime
.
sps_total
=
30
;
*
err
=
NULL
;
...
...
@@ -1314,8 +1317,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime
.
tipping_point
=
5000
;
runtime
.
timer_affinity
=
-
1
;
switch_load_core_config
(
"switch.conf"
);
switch_load_core_config
(
"switch.conf"
);
switch_core_state_machine_init
(
runtime
.
memory_pool
);
...
...
@@ -1435,6 +1438,12 @@ static void switch_load_core_config(const char *file)
if
(
tmp
>
-
1
&&
tmp
<
11
)
{
switch_core_session_ctl
(
SCSC_DEBUG_LEVEL
,
&
tmp
);
}
}
else
if
(
!
strcasecmp
(
var
,
"auto-create-schemas"
))
{
if
(
switch_true
(
val
))
{
switch_set_flag
((
&
runtime
),
SCF_AUTO_SCHEMAS
);
}
else
{
switch_clear_flag
((
&
runtime
),
SCF_AUTO_SCHEMAS
);
}
}
else
if
(
!
strcasecmp
(
var
,
"enable-early-hangup"
)
&&
switch_true
(
val
))
{
switch_set_flag
((
&
runtime
),
SCF_EARLY_HANGUP
);
}
else
if
(
!
strcasecmp
(
var
,
"colorize-console"
)
&&
switch_true
(
val
))
{
...
...
@@ -1583,7 +1592,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
#endif
signal
(
SIGHUP
,
handle_SIGHUP
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Bringing up environment.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Loading Modules.
\n
"
);
if
(
switch_loadable_module_init
()
!=
SWITCH_STATUS_SUCCESS
)
{
...
...
src/switch_core_db.c
浏览文件 @
a11f4e4f
...
...
@@ -196,6 +196,11 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te
{
char
*
errmsg
;
if
(
switch_test_flag
((
&
runtime
),
SCF_AUTO_SCHEMAS
))
{
return
;
}
if
(
db
)
{
if
(
test_sql
)
{
switch_core_db_exec
(
db
,
test_sql
,
NULL
,
NULL
,
&
errmsg
);
...
...
src/switch_core_sqldb.c
浏览文件 @
a11f4e4f
...
...
@@ -784,6 +784,10 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand
char
*
errmsg
;
switch_bool_t
r
=
SWITCH_TRUE
;
if
(
!
switch_test_flag
((
&
runtime
),
SCF_AUTO_SCHEMAS
))
{
return
SWITCH_TRUE
;
}
if
(
dbh
->
io_mutex
)
{
switch_mutex_lock
(
dbh
->
io_mutex
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论