Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
eec93d87
提交
eec93d87
authored
3月 23, 2016
作者:
William King
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8971 Resolve globals struct handling. Thanks to Ben Hood for reporting the issue.
上级
a42ab110
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
26 行增加
和
23 行删除
+26
-23
mod_amqp.c
src/mod/event_handlers/mod_amqp/mod_amqp.c
+11
-10
mod_amqp.h
src/mod/event_handlers/mod_amqp/mod_amqp.h
+5
-3
mod_amqp_command.c
src/mod/event_handlers/mod_amqp/mod_amqp_command.c
+3
-3
mod_amqp_logging.c
src/mod/event_handlers/mod_amqp/mod_amqp_logging.c
+3
-3
mod_amqp_producer.c
src/mod/event_handlers/mod_amqp/mod_amqp_producer.c
+2
-2
mod_amqp_utils.c
src/mod/event_handlers/mod_amqp/mod_amqp_utils.c
+2
-2
没有找到文件。
src/mod/event_handlers/mod_amqp/mod_amqp.c
浏览文件 @
eec93d87
...
...
@@ -42,6 +42,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_amqp_shutdown);
SWITCH_MODULE_LOAD_FUNCTION
(
mod_amqp_load
);
SWITCH_MODULE_DEFINITION
(
mod_amqp
,
mod_amqp_load
,
mod_amqp_shutdown
,
NULL
);
mod_amqp_globals_t
mod_amqp_globals
;
SWITCH_STANDARD_API
(
amqp_reload
)
{
return
mod_amqp_do_config
(
SWITCH_TRUE
);
...
...
@@ -56,13 +58,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amqp_load)
{
switch_api_interface_t
*
api_interface
;
memset
(
&
globals
,
0
,
sizeof
(
globals
));
memset
(
&
mod_amqp_globals
,
0
,
sizeof
(
mod_amqp_globals_t
));
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
globals
.
pool
=
pool
;
switch_core_hash_init
(
&
(
globals
.
producer_hash
));
switch_core_hash_init
(
&
(
globals
.
command_hash
));
switch_core_hash_init
(
&
(
globals
.
logging_hash
));
mod_amqp_
globals
.
pool
=
pool
;
switch_core_hash_init
(
&
(
mod_amqp_
globals
.
producer_hash
));
switch_core_hash_init
(
&
(
mod_amqp_
globals
.
command_hash
));
switch_core_hash_init
(
&
(
mod_amqp_
globals
.
logging_hash
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"mod_apqp loading: Version %s
\n
"
,
switch_version_full
());
...
...
@@ -74,7 +76,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amqp_load)
SWITCH_ADD_API
(
api_interface
,
"amqp"
,
"amqp API"
,
amqp_reload
,
"syntax"
);
switch_log_bind_logger
(
mod_amqp_logging_recv
,
SWITCH_LOG_DEBUG
,
SWITCH_FALSE
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -92,19 +94,18 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_amqp_shutdown)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Mod starting shutting down
\n
"
);
switch_event_unbind_callback
(
mod_amqp_producer_event_handler
);
while
((
hi
=
switch_core_hash_first
(
globals
.
producer_hash
)))
{
while
((
hi
=
switch_core_hash_first
(
mod_amqp_
globals
.
producer_hash
)))
{
switch_core_hash_this
(
hi
,
NULL
,
NULL
,
(
void
**
)
&
producer
);
mod_amqp_producer_destroy
(
&
producer
);
}
while
((
hi
=
switch_core_hash_first
(
globals
.
command_hash
)))
{
while
((
hi
=
switch_core_hash_first
(
mod_amqp_
globals
.
command_hash
)))
{
switch_core_hash_this
(
hi
,
NULL
,
NULL
,
(
void
**
)
&
command
);
mod_amqp_command_destroy
(
&
command
);
}
switch_log_unbind_logger
(
mod_amqp_logging_recv
);
while
((
hi
=
switch_core_hash_first
(
globals
.
logging_hash
)))
{
while
((
hi
=
switch_core_hash_first
(
mod_amqp_globals
.
logging_hash
)))
{
switch_core_hash_this
(
hi
,
NULL
,
NULL
,
(
void
**
)
&
logging
);
mod_amqp_logging_destroy
(
&
logging
);
}
...
...
src/mod/event_handlers/mod_amqp/mod_amqp.h
浏览文件 @
eec93d87
...
...
@@ -173,13 +173,15 @@ typedef struct {
switch_memory_pool_t
*
pool
;
}
mod_amqp_logging_profile_t
;
struct
{
typedef
struct
mod_amqp_globals_s
{
switch_memory_pool_t
*
pool
;
switch_hash_t
*
producer_hash
;
switch_hash_t
*
command_hash
;
switch_hash_t
*
logging_hash
;
}
globals
;
}
mod_amqp_globals_t
;
extern
mod_amqp_globals_t
mod_amqp_globals
;
/* utils */
switch_status_t
mod_amqp_do_config
(
switch_bool_t
reload
);
...
...
src/mod/event_handlers/mod_amqp/mod_amqp_command.c
浏览文件 @
eec93d87
...
...
@@ -53,7 +53,7 @@ switch_status_t mod_amqp_command_destroy(mod_amqp_command_profile_t **prof)
pool
=
profile
->
pool
;
if
(
profile
->
name
)
{
switch_core_hash_delete
(
globals
.
command_hash
,
profile
->
name
);
switch_core_hash_delete
(
mod_amqp_
globals
.
command_hash
,
profile
->
name
);
}
profile
->
running
=
0
;
...
...
@@ -165,7 +165,7 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg)
goto
err
;
}
if
(
switch_core_hash_insert
(
globals
.
command_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_insert
(
mod_amqp_
globals
.
command_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to insert new profile [%s] into mod_amqp profile hash
\n
"
,
name
);
goto
err
;
}
...
...
@@ -219,7 +219,7 @@ static void mod_amqp_command_response(mod_amqp_command_profile_t *profile, char
switch_safe_free
(
json_output
);
if
(
status
<
0
)
{
if
(
status
!=
AMQP_STATUS_OK
)
{
const
char
*
errstr
=
amqp_error_string2
(
-
status
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Profile[%s] failed to send event on connection[%s]: %s
\n
"
,
profile
->
name
,
profile
->
conn_active
->
name
,
errstr
);
...
...
src/mod/event_handlers/mod_amqp/mod_amqp_logging.c
浏览文件 @
eec93d87
...
...
@@ -55,7 +55,7 @@ switch_status_t mod_amqp_logging_recv(const switch_log_node_t *node, switch_log_
3. Queue copy of event into logging profile send queue
4. Destroy local event copy
*/
for
(
hi
=
switch_core_hash_first
(
globals
.
logging_hash
);
hi
;
hi
=
switch_core_hash_next
(
&
hi
))
{
for
(
hi
=
switch_core_hash_first
(
mod_amqp_
globals
.
logging_hash
);
hi
;
hi
=
switch_core_hash_next
(
&
hi
))
{
switch_core_hash_this
(
hi
,
NULL
,
NULL
,
(
void
**
)
&
logging
);
if
(
logging
&&
switch_log_check_mask
(
logging
->
log_level_mask
,
level
)
)
{
...
...
@@ -121,7 +121,7 @@ switch_status_t mod_amqp_logging_destroy(mod_amqp_logging_profile_t **prof)
if
(
profile
->
name
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Profile[%s] shutting down...
\n
"
,
profile
->
name
);
switch_core_hash_delete
(
globals
.
logging_hash
,
profile
->
name
);
switch_core_hash_delete
(
mod_amqp_
globals
.
logging_hash
,
profile
->
name
);
}
profile
->
running
=
0
;
...
...
@@ -269,7 +269,7 @@ switch_status_t mod_amqp_logging_create(char *name, switch_xml_t cfg)
goto
err
;
}
if
(
switch_core_hash_insert
(
globals
.
logging_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_insert
(
mod_amqp_
globals
.
logging_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to insert new profile [%s] into mod_amqp profile hash
\n
"
,
name
);
goto
err
;
}
...
...
src/mod/event_handlers/mod_amqp/mod_amqp_producer.c
浏览文件 @
eec93d87
...
...
@@ -128,7 +128,7 @@ switch_status_t mod_amqp_producer_destroy(mod_amqp_producer_profile_t **prof) {
if
(
profile
->
name
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Profile[%s] shutting down...
\n
"
,
profile
->
name
);
switch_core_hash_delete
(
globals
.
producer_hash
,
profile
->
name
);
switch_core_hash_delete
(
mod_amqp_
globals
.
producer_hash
,
profile
->
name
);
}
profile
->
running
=
0
;
...
...
@@ -366,7 +366,7 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
}
}
if
(
switch_core_hash_insert
(
globals
.
producer_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_hash_insert
(
mod_amqp_
globals
.
producer_hash
,
name
,
(
void
*
)
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to insert new profile [%s] into mod_amqp profile hash
\n
"
,
name
);
goto
err
;
}
...
...
src/mod/event_handlers/mod_amqp/mod_amqp_utils.c
浏览文件 @
eec93d87
...
...
@@ -129,7 +129,7 @@ switch_status_t mod_amqp_do_config(switch_bool_t reload)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load mod_amqp profile. Check configs missing name attr
\n
"
);
continue
;
}
name
=
switch_core_strdup
(
globals
.
pool
,
name
);
name
=
switch_core_strdup
(
mod_amqp_
globals
.
pool
,
name
);
if
(
mod_amqp_command_create
(
name
,
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load mod_amqp profile [%s]. Check configs
\n
"
,
name
);
...
...
@@ -153,7 +153,7 @@ switch_status_t mod_amqp_do_config(switch_bool_t reload)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load mod_amqp profile. Check configs missing name attr
\n
"
);
continue
;
}
name
=
switch_core_strdup
(
globals
.
pool
,
name
);
name
=
switch_core_strdup
(
mod_amqp_
globals
.
pool
,
name
);
if
(
mod_amqp_logging_create
(
name
,
profile
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load mod_amqp profile [%s]. Check configs
\n
"
,
name
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论