Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5dccbe48
提交
5dccbe48
authored
11月 22, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix sql queue manager issues
上级
2b2a4fb2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
18 行删除
+21
-18
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+3
-3
switch_core_sqldb.c
src/switch_core_sqldb.c
+18
-15
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
5dccbe48
...
@@ -873,13 +873,13 @@ static void do_dialog_probe(switch_event_t *event)
...
@@ -873,13 +873,13 @@ static void do_dialog_probe(switch_event_t *event)
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s DUMP DIALOG_PROBE set version sql:
\n
%s
\n
"
,
profile
->
name
,
sql
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s DUMP DIALOG_PROBE set version sql:
\n
%s
\n
"
,
profile
->
name
,
sql
);
}
}
sofia_glue_execute_sql_
now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sofia_glue_execute_sql_
soon
(
profile
,
&
sql
,
SWITCH_TRUE
);
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
// The dialog_probe_callback has built up the dialogs to be included in the NOTIFY.
// The dialog_probe_callback has built up the dialogs to be included in the NOTIFY.
// Now send the "full" dialog event to the triggering subscription.
// Now send the "full" dialog event to the triggering subscription.
sql
=
switch_mprintf
(
"select call_id,expires,sub_to_user,sub_to_host,event,version, "
sql
=
switch_mprintf
(
"select call_id,expires,sub_to_user,sub_to_host,event,version
+1
, "
"'full',full_to,full_from,contact,network_ip,network_port "
"'full',full_to,full_from,contact,network_ip,network_port "
"from sip_subscriptions "
"from sip_subscriptions "
"where hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and call_id='%q'"
,
"where hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and call_id='%q'"
,
...
@@ -4543,7 +4543,7 @@ void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now)
...
@@ -4543,7 +4543,7 @@ void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now)
"((expires > 0 and expires <= %ld)) and profile_name='%q' and hostname='%q'"
,
"((expires > 0 and expires <= %ld)) and profile_name='%q' and hostname='%q'"
,
(
long
)
now
,
profile
->
name
,
mod_sofia_globals
.
hostname
);
(
long
)
now
,
profile
->
name
,
mod_sofia_globals
.
hostname
);
sofia_glue_execute_sql_
now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sofia_glue_execute_sql_
soon
(
profile
,
&
sql
,
SWITCH_TRUE
);
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
sql
=
switch_mprintf
(
"select full_to, full_from, contact, -1, call_id, event, network_ip, network_port, "
sql
=
switch_mprintf
(
"select full_to, full_from, contact, -1, call_id, event, network_ip, network_port, "
...
...
src/switch_core_sqldb.c
浏览文件 @
5dccbe48
...
@@ -1314,10 +1314,12 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_start(switch_sql_queue_
...
@@ -1314,10 +1314,12 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_start(switch_sql_queue_
}
}
static
void
do_flush
(
switch_
queue_t
*
q
,
switch_cache_db_handle_t
*
dbh
)
static
void
do_flush
(
switch_
sql_queue_manager_t
*
qm
,
int
i
,
switch_cache_db_handle_t
*
dbh
)
{
{
void
*
pop
=
NULL
;
void
*
pop
=
NULL
;
switch_queue_t
*
q
=
qm
->
sql_queue
[
i
];
switch_mutex_lock
(
qm
->
mutex
);
while
(
switch_queue_trypop
(
q
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
while
(
switch_queue_trypop
(
q
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
pop
)
{
if
(
pop
)
{
if
(
dbh
)
{
if
(
dbh
)
{
...
@@ -1326,6 +1328,7 @@ static void do_flush(switch_queue_t *q, switch_cache_db_handle_t *dbh)
...
@@ -1326,6 +1328,7 @@ static void do_flush(switch_queue_t *q, switch_cache_db_handle_t *dbh)
free
(
pop
);
free
(
pop
);
}
}
}
}
switch_mutex_unlock
(
qm
->
mutex
);
}
}
...
@@ -1347,7 +1350,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queu
...
@@ -1347,7 +1350,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queu
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
do_flush
(
qm
->
sql_queue
[
i
]
,
NULL
);
do_flush
(
qm
,
i
,
NULL
);
}
}
pool
=
qm
->
pool
;
pool
=
qm
->
pool
;
...
@@ -1408,7 +1411,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
...
@@ -1408,7 +1411,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
switch_queue_push
(
qm
->
sql_queue
[
pos
],
dup
?
strdup
(
sql
)
:
(
char
*
)
sql
);
switch_queue_push
(
qm
->
sql_queue
[
pos
],
dup
?
strdup
(
sql
)
:
(
char
*
)
sql
);
written
=
qm
->
written
[
pos
];
written
=
qm
->
written
[
pos
];
size
=
switch_sql_queue_manager_size
(
qm
,
pos
);
size
=
switch_sql_queue_manager_size
(
qm
,
pos
);
want
=
written
+
size
;
want
=
written
+
qm
->
pre_written
[
pos
]
+
size
;
switch_mutex_unlock
(
qm
->
mutex
);
switch_mutex_unlock
(
qm
->
mutex
);
qm_wake
(
qm
);
qm_wake
(
qm
);
...
@@ -1563,7 +1566,9 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm)
...
@@ -1563,7 +1566,9 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm)
if
(
pop
)
{
if
(
pop
)
{
if
((
status
=
switch_cache_db_execute_sql
(
qm
->
event_db
,
(
char
*
)
pop
,
NULL
))
==
SWITCH_STATUS_SUCCESS
)
{
if
((
status
=
switch_cache_db_execute_sql
(
qm
->
event_db
,
(
char
*
)
pop
,
NULL
))
==
SWITCH_STATUS_SUCCESS
)
{
switch_mutex_lock
(
qm
->
mutex
);
qm
->
pre_written
[
i
]
++
;
qm
->
pre_written
[
i
]
++
;
switch_mutex_unlock
(
qm
->
mutex
);
ttl
++
;
ttl
++
;
}
}
free
(
pop
);
free
(
pop
);
...
@@ -1633,7 +1638,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
...
@@ -1633,7 +1638,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
uint32_t
sanity
=
120
;
uint32_t
sanity
=
120
;
switch_sql_queue_manager_t
*
qm
=
(
switch_sql_queue_manager_t
*
)
obj
;
switch_sql_queue_manager_t
*
qm
=
(
switch_sql_queue_manager_t
*
)
obj
;
uint32_t
i
,
countdown
=
0
;
uint32_t
i
;
while
(
!
qm
->
event_db
)
{
while
(
!
qm
->
event_db
)
{
if
(
switch_cache_db_get_db_handle_dsn
(
&
qm
->
event_db
,
qm
->
dsn
)
==
SWITCH_STATUS_SUCCESS
&&
qm
->
event_db
)
if
(
switch_cache_db_get_db_handle_dsn
(
&
qm
->
event_db
,
qm
->
dsn
)
==
SWITCH_STATUS_SUCCESS
&&
qm
->
event_db
)
...
@@ -1674,7 +1679,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
...
@@ -1674,7 +1679,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
if
(
sql_manager
.
paused
)
{
if
(
sql_manager
.
paused
)
{
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
do_flush
(
qm
->
sql_queue
[
i
]
,
NULL
);
do_flush
(
qm
,
i
,
NULL
);
}
}
goto
check
;
goto
check
;
}
}
...
@@ -1707,21 +1712,19 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
...
@@ -1707,21 +1712,19 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
check
:
check
:
countdown
=
40
;
if
((
lc
=
qm_ttl
(
qm
))
<
qm
->
max_trans
/
4
)
{
switch_yield
(
500000
);
while
(
--
countdown
&&
(
lc
=
qm_ttl
(
qm
))
<
qm
->
max_trans
/
4
)
{
}
else
if
(
lc
==
0
)
{
if
(
lc
==
0
)
{
switch_thread_cond_wait
(
qm
->
cond
,
qm
->
cond_mutex
);
switch_thread_cond_wait
(
qm
->
cond
,
qm
->
cond_mutex
);
break
;
}
else
{
}
switch_cond_next
();
switch_yield
(
5000
);
}
}
}
}
switch_mutex_unlock
(
qm
->
cond_mutex
);
switch_mutex_unlock
(
qm
->
cond_mutex
);
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
for
(
i
=
0
;
i
<
qm
->
numq
;
i
++
)
{
do_flush
(
qm
->
sql_queue
[
i
]
,
qm
->
event_db
);
do_flush
(
qm
,
i
,
qm
->
event_db
);
}
}
qm
->
thread_running
=
0
;
qm
->
thread_running
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论