Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
87f65f17
提交
87f65f17
authored
5月 24, 2012
作者:
Tamas Cseke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add session r/w locking FS-3432
上级
fdd3a8d3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
14 行删除
+14
-14
mod_erlang_event.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
+13
-14
mod_erlang_event.h
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
+1
-0
没有找到文件。
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
浏览文件 @
87f65f17
...
@@ -137,8 +137,10 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t
...
@@ -137,8 +137,10 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t
switch_thread_rwlock_rdlock
(
listener
->
session_rwlock
);
switch_thread_rwlock_rdlock
(
listener
->
session_rwlock
);
s
=
(
session_elem_t
*
)
switch_core_hash_find
(
listener
->
sessions
,
uuid
);
if
((
s
=
(
session_elem_t
*
)
switch_core_hash_find
(
listener
->
sessions
,
uuid
)))
{
/* TODO - we don't need to hold the lock, we need to lock the session */
switch_thread_rwlock_rdlock
(
s
->
rwlock
);
}
switch_thread_rwlock_unlock
(
listener
->
session_rwlock
);
if
(
s
)
{
if
(
s
)
{
int
send
=
0
;
int
send
=
0
;
...
@@ -166,8 +168,9 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t
...
@@ -166,8 +168,9 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
s
->
uuid_str
),
SWITCH_LOG_DEBUG
,
"Ignoring event %s for attached session %s
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
s
->
uuid_str
),
SWITCH_LOG_DEBUG
,
"Ignoring event %s for attached session %s
\n
"
,
switch_event_name
(
event
->
event_id
),
s
->
uuid_str
);
switch_event_name
(
event
->
event_id
),
s
->
uuid_str
);
}
}
switch_thread_rwlock_unlock
(
s
->
rwlock
);
}
}
switch_thread_rwlock_unlock
(
listener
->
session_rwlock
);
}
}
static
void
event_handler
(
switch_event_t
*
event
)
static
void
event_handler
(
switch_event_t
*
event
)
...
@@ -329,13 +332,15 @@ static void destroy_session_elem(session_elem_t *session_element)
...
@@ -329,13 +332,15 @@ static void destroy_session_elem(session_elem_t *session_element)
{
{
switch_core_session_t
*
session
;
switch_core_session_t
*
session
;
/* wait for readers */
switch_thread_rwlock_wrlock
(
session_element
->
rwlock
);
switch_thread_rwlock_unlock
(
session_element
->
rwlock
);
if
((
session
=
switch_core_session_locate
(
session_element
->
uuid_str
)))
{
if
((
session
=
switch_core_session_locate
(
session_element
->
uuid_str
)))
{
switch_channel_clear_flag
(
switch_core_session_get_channel
(
session
),
CF_CONTROLLED
);
switch_channel_clear_flag
(
switch_core_session_get_channel
(
session
),
CF_CONTROLLED
);
switch_core_session_rwunlock
(
session
);
switch_core_session_rwunlock
(
session
);
}
}
switch_core_destroy_memory_pool
(
&
session_element
->
pool
);
switch_core_destroy_memory_pool
(
&
session_element
->
pool
);
session_element
=
NULL
;
/*switch_safe_free(s); */
}
}
...
@@ -890,15 +895,7 @@ static void listener_main_loop(listener_t *listener)
...
@@ -890,15 +895,7 @@ static void listener_main_loop(listener_t *listener)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"erl_exit from %s <%d.%d.%d>
\n
"
,
msg
.
from
.
node
,
msg
.
from
.
creation
,
msg
.
from
.
num
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"erl_exit from %s <%d.%d.%d>
\n
"
,
msg
.
from
.
node
,
msg
.
from
.
creation
,
msg
.
from
.
num
,
msg
.
from
.
serial
);
msg
.
from
.
serial
);
switch_thread_rwlock_rdlock
(
globals
.
listener_rwlock
);
handle_exit
(
listener
,
&
msg
.
from
);
if
(
listener
)
{
/* get the listener lock */
switch_thread_rwlock_wrlock
(
listener
->
rwlock
);
/* wipe event hash */
handle_exit
(
listener
,
&
msg
.
from
);
switch_thread_rwlock_unlock
(
listener
->
rwlock
);
}
switch_thread_rwlock_unlock
(
globals
.
listener_rwlock
);
break
;
break
;
default
:
default
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"unexpected msg type %d
\n
"
,
(
int
)
(
msg
.
msgtype
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"unexpected msg type %d
\n
"
,
(
int
)
(
msg
.
msgtype
));
...
@@ -1318,6 +1315,8 @@ session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t
...
@@ -1318,6 +1315,8 @@ session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t
session_element
->
event_list
[
x
]
=
0
;
session_element
->
event_list
[
x
]
=
0
;
}
}
switch_thread_rwlock_create
(
&
session_element
->
rwlock
,
session_element
->
pool
);
session_element
->
event_list
[
SWITCH_EVENT_ALL
]
=
1
;
/* defaults to everything */
session_element
->
event_list
[
SWITCH_EVENT_ALL
]
=
1
;
/* defaults to everything */
switch_channel_set_private
(
channel
,
"_erlang_session_"
,
session_element
);
switch_channel_set_private
(
channel
,
"_erlang_session_"
,
session_element
);
...
...
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
浏览文件 @
87f65f17
...
@@ -83,6 +83,7 @@ struct session_elem {
...
@@ -83,6 +83,7 @@ struct session_elem {
uint32_t
flags
;
uint32_t
flags
;
struct
erlang_process
process
;
struct
erlang_process
process
;
switch_queue_t
*
event_queue
;
switch_queue_t
*
event_queue
;
switch_thread_rwlock_t
*
rwlock
;
switch_channel_state_t
channel_state
;
switch_channel_state_t
channel_state
;
switch_memory_pool_t
*
pool
;
switch_memory_pool_t
*
pool
;
uint8_t
event_list
[
SWITCH_EVENT_ALL
+
1
];
uint8_t
event_list
[
SWITCH_EVENT_ALL
+
1
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论