Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b185cc6e
提交
b185cc6e
authored
1月 24, 2018
作者:
Mathieu Bodjikian (MacBook-Pro-de-Mathieu.local)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10299: [mod_callcenter] Add an option to disable global database lock on mod_callcenter
上级
78c189bf
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
45 行增加
和
24 行删除
+45
-24
mod_callcenter.c
src/mod/applications/mod_callcenter/mod_callcenter.c
+45
-24
没有找到文件。
src/mod/applications/mod_callcenter/mod_callcenter.c
浏览文件 @
b185cc6e
...
...
@@ -429,6 +429,7 @@ static struct {
switch_bool_t
reserve_agents
;
switch_bool_t
truncate_tiers
;
switch_bool_t
truncate_agents
;
switch_bool_t
global_database_lock
;
int32_t
threads
;
int32_t
running
;
switch_mutex_t
*
mutex
;
...
...
@@ -605,10 +606,12 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch
switch_cache_db_handle_t
*
dbh
=
NULL
;
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
}
}
if
(
!
(
dbh
=
cc_get_db_handle
()))
{
...
...
@@ -621,10 +624,12 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch
end:
switch_cache_db_release_db_handle
(
&
dbh
);
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
}
}
return
ret
;
...
...
@@ -635,10 +640,12 @@ static switch_status_t cc_execute_sql(cc_queue_t *queue, char *sql, switch_mutex
switch_cache_db_handle_t
*
dbh
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
}
}
if
(
!
(
dbh
=
cc_get_db_handle
()))
{
...
...
@@ -652,10 +659,12 @@ end:
switch_cache_db_release_db_handle
(
&
dbh
);
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
}
}
return
status
;
...
...
@@ -667,10 +676,12 @@ static switch_bool_t cc_execute_sql_callback(cc_queue_t *queue, switch_mutex_t *
char
*
errmsg
=
NULL
;
switch_cache_db_handle_t
*
dbh
=
NULL
;
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
}
else
{
switch_mutex_lock
(
globals
.
mutex
);
}
}
if
(
!
(
dbh
=
cc_get_db_handle
()))
{
...
...
@@ -689,10 +700,12 @@ end:
switch_cache_db_release_db_handle
(
&
dbh
);
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
if
(
globals
.
global_database_lock
)
{
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
}
else
{
switch_mutex_unlock
(
globals
.
mutex
);
}
}
return
ret
;
...
...
@@ -1461,6 +1474,7 @@ static switch_status_t load_config(void)
switch_mutex_lock
(
globals
.
mutex
);
globals
.
core_uuid
=
switch_core_get_uuid
();
globals
.
global_database_lock
=
SWITCH_TRUE
;
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
...
...
@@ -1478,6 +1492,8 @@ static switch_status_t load_config(void)
globals
.
truncate_tiers
=
switch_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"truncate-agents-on-load"
))
{
globals
.
truncate_agents
=
switch_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"global-database-lock"
))
{
globals
.
global_database_lock
=
switch_true
(
val
);
}
}
}
...
...
@@ -1489,6 +1505,11 @@ static switch_status_t load_config(void)
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Reserving Agents before offering calls.
\n
"
);
}
if
(
!
globals
.
global_database_lock
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Disabling global database lock
\n
"
);
}
/* Initialize database */
if
(
!
(
dbh
=
cc_get_db_handle
()))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Cannot open DB!
\n
"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论