Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9fe440b2
提交
9fe440b2
authored
1月 22, 2011
作者:
Andrew Thompson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_erlang_event Add proper locking for the list of XML bindings
上级
8d6d52e0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
6 行删除
+12
-6
handle_msg.c
src/mod/event_handlers/mod_erlang_event/handle_msg.c
+2
-2
mod_erlang_event.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
+9
-4
mod_erlang_event.h
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
+1
-0
没有找到文件。
src/mod/event_handlers/mod_erlang_event/handle_msg.c
浏览文件 @
9fe440b2
...
...
@@ -778,7 +778,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e
binding
->
process
.
pid
=
msg
->
from
;
binding
->
listener
=
listener
;
switch_thread_rwlock_wrlock
(
globals
.
listener
_rwlock
);
switch_thread_rwlock_wrlock
(
globals
.
bindings
_rwlock
);
for
(
ptr
=
bindings
.
head
;
ptr
&&
ptr
->
next
;
ptr
=
ptr
->
next
);
...
...
@@ -789,7 +789,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e
}
switch_xml_set_binding_sections
(
bindings
.
search_binding
,
switch_xml_get_binding_sections
(
bindings
.
search_binding
)
|
section
);
switch_thread_rwlock_unlock
(
globals
.
listener
_rwlock
);
switch_thread_rwlock_unlock
(
globals
.
bindings
_rwlock
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"sections %d
\n
"
,
switch_xml_get_binding_sections
(
bindings
.
search_binding
));
...
...
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
浏览文件 @
9fe440b2
...
...
@@ -90,7 +90,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid)
{
struct
erlang_binding
*
ptr
,
*
lst
=
NULL
;
switch_thread_rwlock_wrlock
(
globals
.
listener
_rwlock
);
switch_thread_rwlock_wrlock
(
globals
.
bindings
_rwlock
);
switch_xml_set_binding_sections
(
bindings
.
search_binding
,
SWITCH_XML_SECTION_MAX
);
...
...
@@ -100,7 +100,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid)
if
(
ptr
->
next
)
{
bindings
.
head
=
ptr
->
next
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Removed all (only?)
listeners
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Removed all (only?)
binding
\n
"
);
bindings
.
head
=
NULL
;
break
;
}
...
...
@@ -111,13 +111,13 @@ static void remove_binding(listener_t *listener, erlang_pid * pid)
lst
->
next
=
NULL
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Removed
listener
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Removed
binding
\n
"
);
}
else
{
switch_xml_set_binding_sections
(
bindings
.
search_binding
,
switch_xml_get_binding_sections
(
bindings
.
search_binding
)
|
ptr
->
section
);
}
}
switch_thread_rwlock_unlock
(
globals
.
listener
_rwlock
);
switch_thread_rwlock_unlock
(
globals
.
bindings
_rwlock
);
}
...
...
@@ -381,6 +381,8 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
section
=
switch_xml_parse_section_string
((
char
*
)
sectionstr
);
switch_thread_rwlock_rdlock
(
globals
.
bindings_rwlock
);
for
(
ptr
=
bindings
.
head
;
ptr
;
ptr
=
ptr
->
next
)
{
if
(
ptr
->
section
!=
section
)
continue
;
...
...
@@ -417,6 +419,8 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
switch_mutex_unlock
(
ptr
->
listener
->
sock_mutex
);
}
switch_thread_rwlock_unlock
(
globals
.
bindings_rwlock
);
ei_x_free
(
&
buf
);
if
(
!
p
)
{
...
...
@@ -1638,6 +1642,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load)
memset
(
&
prefs
,
0
,
sizeof
(
prefs
));
switch_thread_rwlock_create
(
&
globals
.
listener_rwlock
,
pool
);
switch_thread_rwlock_create
(
&
globals
.
bindings_rwlock
,
pool
);
switch_mutex_init
(
&
globals
.
fetch_reply_mutex
,
SWITCH_MUTEX_DEFAULT
,
pool
);
switch_mutex_init
(
&
globals
.
listener_count_mutex
,
SWITCH_MUTEX_UNNESTED
,
pool
);
switch_core_hash_init
(
&
globals
.
fetch_reply_hash
,
pool
);
...
...
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
浏览文件 @
9fe440b2
...
...
@@ -161,6 +161,7 @@ struct api_command_struct {
struct
globals_struct
{
switch_thread_rwlock_t
*
listener_rwlock
;
switch_thread_rwlock_t
*
bindings_rwlock
;
switch_event_node_t
*
node
;
switch_mutex_t
*
ref_mutex
;
switch_mutex_t
*
fetch_reply_mutex
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论