Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8423f28d
提交
8423f28d
authored
2月 17, 2016
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8841 #resolve [Debian - FS Hang ]
上级
0311e4b5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
79 行增加
和
50 行删除
+79
-50
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+16
-7
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+2
-0
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+61
-37
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+0
-6
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
8423f28d
...
...
@@ -5008,7 +5008,7 @@ static int notify_callback(void *pArg, int argc, char **argv, char **columnNames
return
0
;
}
static
void
general_event_handler
(
switch_event_t
*
event
)
void
general_event_handler
(
switch_event_t
*
event
)
{
switch
(
event
->
event_id
)
{
case
SWITCH_EVENT_NOTIFY
:
...
...
@@ -5546,6 +5546,14 @@ static void general_event_handler(switch_event_t *event)
}
}
static
void
general_queue_event_handler
(
switch_event_t
*
event
)
{
switch_event_t
*
dup
;
switch_event_dup
(
&
dup
,
event
);
switch_queue_push
(
mod_sofia_globals
.
general_event_queue
,
dup
);
}
void
write_csta_xml_chunk
(
switch_event_t
*
event
,
switch_stream_handle_t
stream
,
const
char
*
csta_event
,
char
*
fwdtype
)
{
const
char
*
device
=
switch_event_get_header
(
event
,
"device"
);
...
...
@@ -5882,6 +5890,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
mod_sofia_globals
.
auto_nat
=
(
switch_nat_get_type
()
?
1
:
0
);
switch_queue_create
(
&
mod_sofia_globals
.
presence_queue
,
SOFIA_QUEUE_SIZE
,
mod_sofia_globals
.
pool
);
switch_queue_create
(
&
mod_sofia_globals
.
general_event_queue
,
SOFIA_QUEUE_SIZE
,
mod_sofia_globals
.
pool
);
mod_sofia_globals
.
cpu_count
=
switch_core_cpu_count
();
mod_sofia_globals
.
max_msg_queues
=
(
mod_sofia_globals
.
cpu_count
/
2
)
+
1
;
...
...
@@ -5952,27 +5961,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_TRAP
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_TRAP
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_
queue_
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_NOTIFY
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_NOTIFY
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_
queue_
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_PHONE_FEATURE
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_PHONE_FEATURE
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_
queue_
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_SEND_MESSAGE
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_SEND_MESSAGE
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_
queue_
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_SEND_INFO
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_SEND_INFO
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_
queue_
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
...
...
@@ -6075,7 +6084,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
switch_event_unbind_callback
(
sofia_presence_event_handler
);
switch_event_unbind_callback
(
general_event_handler
);
switch_event_unbind_callback
(
general_
queue_
event_handler
);
switch_event_unbind_callback
(
event_handler
);
switch_queue_push
(
mod_sofia_globals
.
presence_queue
,
NULL
);
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
8423f28d
...
...
@@ -365,6 +365,7 @@ struct mod_sofia_globals {
char
hostname
[
512
];
switch_queue_t
*
presence_queue
;
switch_queue_t
*
msg_queue
;
switch_queue_t
*
general_event_queue
;
switch_thread_t
*
msg_queue_thread
[
SOFIA_MAX_MSG_QUEUE
];
int
msg_queue_len
;
struct
sofia_private
destroy_private
;
...
...
@@ -1193,6 +1194,7 @@ void sofia_glue_fire_events(sofia_profile_t *profile);
void
sofia_event_fire
(
sofia_profile_t
*
profile
,
switch_event_t
**
event
);
void
sofia_queue_message
(
sofia_dispatch_event_t
*
de
);
int
sofia_glue_check_nat
(
sofia_profile_t
*
profile
,
const
char
*
network_ip
);
void
general_event_handler
(
switch_event_t
*
event
);
switch_status_t
sofia_glue_ext_address_lookup
(
sofia_profile_t
*
profile
,
char
**
ip
,
switch_port_t
*
port
,
const
char
*
sourceip
,
switch_memory_pool_t
*
pool
);
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
8423f28d
...
...
@@ -2659,64 +2659,88 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
uint32_t
ireg_loops
=
profile
->
ireg_seconds
;
/* Number of loop iterations done when we haven't checked for registrations */
uint32_t
iping_loops
=
profile
->
iping_freq
;
/* Number of loop iterations done when we haven't checked for ping expires */
uint32_t
gateway_loops
=
GATEWAY_SECONDS
;
/* Number of loop iterations done when we haven't checked for gateways */
void
*
pop
;
int
tick
=
0
,
x
=
0
;
sofia_set_pflag_locked
(
profile
,
PFLAG_WORKER_RUNNING
);
while
((
mod_sofia_globals
.
running
==
1
&&
sofia_test_pflag
(
profile
,
PFLAG_RUNNING
)))
{
if
(
profile
->
watchdog_enabled
)
{
uint32_t
event_diff
=
0
,
step_diff
=
0
,
event_fail
=
0
,
step_fail
=
0
;
if
(
tick
)
{
if
(
profile
->
watchdog_enabled
)
{
uint32_t
event_diff
=
0
,
step_diff
=
0
,
event_fail
=
0
,
step_fail
=
0
;
if
(
profile
->
step_timeout
)
{
step_diff
=
(
uint32_t
)
((
switch_time_now
()
-
profile
->
last_root_step
)
/
1000
);
if
(
profile
->
step_timeout
)
{
step_diff
=
(
uint32_t
)
((
switch_time_now
()
-
profile
->
last_root_step
)
/
1000
);
if
(
step_diff
>
profile
->
step_timeout
)
{
step_fail
=
1
;
if
(
step_diff
>
profile
->
step_timeout
)
{
step_fail
=
1
;
}
}
}
if
(
profile
->
event_timeout
)
{
event_diff
=
(
uint32_t
)
((
switch_time_now
()
-
profile
->
last_sip_event
)
/
1000
);
if
(
profile
->
event_timeout
)
{
event_diff
=
(
uint32_t
)
((
switch_time_now
()
-
profile
->
last_sip_event
)
/
1000
);
if
(
event_diff
>
profile
->
event_timeout
)
{
event_fail
=
1
;
if
(
event_diff
>
profile
->
event_timeout
)
{
event_fail
=
1
;
}
}
}
if
(
step_fail
&&
profile
->
event_timeout
&&
!
event_fail
)
{
step_fail
=
0
;
}
if
(
step_fail
&&
profile
->
event_timeout
&&
!
event_fail
)
{
step_fail
=
0
;
}
if
(
event_fail
||
step_fail
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Profile %s: SIP STACK FAILURE DETECTED BY WATCHDOG!
\n
"
"GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE
\n
"
,
profile
->
name
);
switch_yield
(
2000000
);
watchdog_triggered_abort
();
if
(
event_fail
||
step_fail
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Profile %s: SIP STACK FAILURE DETECTED BY WATCHDOG!
\n
"
"GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE
\n
"
,
profile
->
name
);
switch_yield
(
2000000
);
watchdog_triggered_abort
();
}
}
}
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_STANDBY
))
{
if
(
++
ireg_loops
>=
(
uint32_t
)
profile
->
ireg_seconds
)
{
time_t
now
=
switch_epoch_time_now
(
NULL
);
sofia_reg_check_expire
(
profile
,
now
,
0
);
ireg_loops
=
0
;
}
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_STANDBY
))
{
if
(
++
ireg_loops
>=
(
uint32_t
)
profile
->
ireg_seconds
)
{
time_t
now
=
switch_epoch_time_now
(
NULL
);
sofia_reg_check_expire
(
profile
,
now
,
0
);
ireg_loops
=
0
;
}
if
(
++
iping_loops
>=
(
uint32_t
)
profile
->
iping_freq
)
{
time_t
now
=
switch_epoch_time_now
(
NULL
);
sofia_reg_check_ping_expire
(
profile
,
now
,
profile
->
iping_seconds
);
iping_loops
=
0
;
}
if
(
++
iping_loops
>=
(
uint32_t
)
profile
->
iping_freq
)
{
time_t
now
=
switch_epoch_time_now
(
NULL
);
sofia_reg_check_ping_expire
(
profile
,
now
,
profile
->
iping_seconds
);
iping_loops
=
0
;
}
if
(
++
gateway_loops
>=
GATEWAY_SECONDS
)
{
sofia_reg_check_gateway
(
profile
,
switch_epoch_time_now
(
NULL
));
sofia_sub_check_gateway
(
profile
,
switch_epoch_time_now
(
NULL
));
gateway_loops
=
0
;
if
(
++
gateway_loops
>=
GATEWAY_SECONDS
)
{
sofia_reg_check_gateway
(
profile
,
switch_epoch_time_now
(
NULL
));
sofia_sub_check_gateway
(
profile
,
switch_epoch_time_now
(
NULL
));
gateway_loops
=
0
;
}
}
tick
=
0
;
}
switch_yield
(
1000000
);
if
(
switch_queue_pop_timeout
(
mod_sofia_globals
.
general_event_queue
,
&
pop
,
100000
)
==
SWITCH_STATUS_SUCCESS
)
{
do
{
switch_event_t
*
event
=
(
switch_event_t
*
)
pop
;
general_event_handler
(
event
);
switch_event_destroy
(
&
event
);
pop
=
NULL
;
switch_queue_trypop
(
mod_sofia_globals
.
general_event_queue
,
&
pop
);
}
while
(
pop
);
}
sofia_glue_fire_events
(
profile
);
if
(
++
x
==
10
)
{
tick
=
1
;
x
=
0
;
}
}
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
8423f28d
...
...
@@ -2476,9 +2476,6 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
switch_cache_db_release_db_handle
(
&
dbh
);
sofia_glue_fire_events
(
profile
);
return
ret
;
}
...
...
@@ -2515,9 +2512,6 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
switch_cache_db_release_db_handle
(
&
dbh
);
sofia_glue_fire_events
(
profile
);
return
ret
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论