Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9a667aeb
提交
9a667aeb
authored
7月 23, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix leak
上级
86703188
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
79 行增加
和
18 行删除
+79
-18
mod_fifo.c
src/mod/applications/mod_fifo/mod_fifo.c
+72
-15
switch_core_sqldb.c
src/switch_core_sqldb.c
+7
-3
没有找到文件。
src/mod/applications/mod_fifo/mod_fifo.c
浏览文件 @
9a667aeb
...
@@ -720,6 +720,8 @@ static switch_status_t fifo_execute_sql(char *sql, switch_mutex_t *mutex)
...
@@ -720,6 +720,8 @@ static switch_status_t fifo_execute_sql(char *sql, switch_mutex_t *mutex)
goto
end
;
goto
end
;
}
}
if
(
globals
.
debug
>
1
)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"sql: %s
\n
"
,
sql
);
status
=
switch_cache_db_execute_sql
(
dbh
,
sql
,
NULL
);
status
=
switch_cache_db_execute_sql
(
dbh
,
sql
,
NULL
);
end:
end:
...
@@ -1135,8 +1137,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
...
@@ -1135,8 +1137,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
const
char
*
codec
;
const
char
*
codec
;
struct
call_helper
*
rows
[
MAX_ROWS
]
=
{
0
};
struct
call_helper
*
rows
[
MAX_ROWS
]
=
{
0
};
int
rowcount
=
0
;
int
rowcount
=
0
;
switch_memory_pool_t
*
pool
;
if
(
!
globals
.
running
)
return
NULL
;
if
(
!
globals
.
running
)
return
NULL
;
switch_uuid_get
(
&
uuid
);
switch_uuid_get
(
&
uuid
);
...
@@ -1322,6 +1324,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
...
@@ -1322,6 +1324,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
add_caller_outbound_call
(
id
,
&
cancel_cause
);
add_caller_outbound_call
(
id
,
&
cancel_cause
);
if
(
globals
.
debug
)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s dialing: %s
\n
"
,
node
->
name
,
originate_string
);
status
=
switch_ivr_originate
(
NULL
,
&
session
,
&
cause
,
originate_string
,
timeout
,
NULL
,
NULL
,
NULL
,
NULL
,
ovars
,
SOF_NONE
,
&
cancel_cause
);
status
=
switch_ivr_originate
(
NULL
,
&
session
,
&
cause
,
originate_string
,
timeout
,
NULL
,
NULL
,
NULL
,
NULL
,
ovars
,
SOF_NONE
,
&
cancel_cause
);
del_caller_outbound_call
(
id
);
del_caller_outbound_call
(
id
);
...
@@ -1447,7 +1451,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
...
@@ -1447,7 +1451,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
switch_event_destroy
(
&
pop_dup
);
switch_event_destroy
(
&
pop_dup
);
}
}
switch_core_destroy_memory_pool
(
&
cbh
->
pool
);
pool
=
cbh
->
pool
;
switch_core_destroy_memory_pool
(
&
pool
);
switch_mutex_lock
(
globals
.
mutex
);
switch_mutex_lock
(
globals
.
mutex
);
globals
.
threads
--
;
globals
.
threads
--
;
...
@@ -1687,14 +1692,14 @@ static void find_consumers(fifo_node_t *node)
...
@@ -1687,14 +1692,14 @@ static void find_consumers(fifo_node_t *node)
{
{
switch_thread_t
*
thread
;
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
switch_threadattr_t
*
thd_attr
=
NULL
;
struct
callback_helper
*
cbh
;
struct
callback_helper
*
cbh
=
NULL
;
switch_memory_pool_t
*
pool
=
NULL
;
switch_memory_pool_t
*
pool
=
NULL
;
switch_core_new_memory_pool
(
&
pool
);
switch_core_new_memory_pool
(
&
pool
);
cbh
=
switch_core_alloc
(
pool
,
sizeof
(
*
cbh
));
cbh
=
switch_core_alloc
(
pool
,
sizeof
(
*
cbh
));
cbh
->
pool
=
pool
;
cbh
->
pool
=
pool
;
cbh
->
need
=
1
;
cbh
->
need
=
1
;
if
(
node
->
outbound_per_cycle
!=
cbh
->
need
)
{
if
(
node
->
outbound_per_cycle
!=
cbh
->
need
)
{
cbh
->
need
=
node
->
outbound_per_cycle
;
cbh
->
need
=
node
->
outbound_per_cycle
;
}
}
...
@@ -1706,6 +1711,8 @@ static void find_consumers(fifo_node_t *node)
...
@@ -1706,6 +1711,8 @@ static void find_consumers(fifo_node_t *node)
switch_threadattr_detach_set
(
thd_attr
,
1
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_thread_create
(
&
thread
,
thd_attr
,
ringall_thread_run
,
cbh
,
cbh
->
pool
);
switch_thread_create
(
&
thread
,
thd_attr
,
ringall_thread_run
,
cbh
,
cbh
->
pool
);
}
else
{
switch_core_destroy_memory_pool
(
&
pool
);
}
}
}
}
...
@@ -1733,9 +1740,8 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o
...
@@ -1733,9 +1740,8 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o
switch_mutex_lock
(
globals
.
mutex
);
switch_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
debug
)
{
if
(
globals
.
debug
)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Trying priority: %d
\n
"
,
cur_priority
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Trying priority: %d
\n
"
,
cur_priority
);
}
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
fifo_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
fifo_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
switch_hash_this
(
hi
,
&
var
,
NULL
,
&
val
);
switch_hash_this
(
hi
,
&
var
,
NULL
,
&
val
);
...
@@ -3507,8 +3513,52 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
...
@@ -3507,8 +3513,52 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
}
}
void
dump_hash
(
switch_hash_t
*
hash
,
switch_stream_handle_t
*
stream
)
{
switch_hash_index_t
*
hi
;
void
*
val
;
const
void
*
var
;
switch_mutex_lock
(
globals
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
switch_hash_this
(
hi
,
&
var
,
NULL
,
&
val
);
stream
->
write_function
(
stream
,
" %s: %s
\n
"
,
(
char
*
)
var
,
(
char
*
)
val
);
}
switch_mutex_unlock
(
globals
.
mutex
);
}
void
node_dump
(
switch_stream_handle_t
*
stream
)
{
#define FIFO_API_SYNTAX "list|list_verbose|count|importance [<fifo name>]|reparse [del_all]"
switch_hash_index_t
*
hi
;
fifo_node_t
*
node
;
void
*
val
;
switch_mutex_lock
(
globals
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
fifo_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
switch_hash_this
(
hi
,
NULL
,
NULL
,
&
val
);
if
((
node
=
(
fifo_node_t
*
)
val
))
{
stream
->
write_function
(
stream
,
"node: %s outbound_name=%s outbound_per_cycle=%d outbound_priority=%d outbound_strategy=%s
\n
"
,
node
->
name
,
node
->
outbound_name
,
node
->
outbound_per_cycle
,
node
->
outbound_priority
,
strat_parse
(
node
->
outbound_strategy
));
}
}
stream
->
write_function
(
stream
,
" caller_orig:
\n
"
);
dump_hash
(
globals
.
caller_orig_hash
,
stream
);
stream
->
write_function
(
stream
,
" consumer_orig:
\n
"
);
dump_hash
(
globals
.
consumer_orig_hash
,
stream
);
stream
->
write_function
(
stream
,
" bridge:
\n
"
);
dump_hash
(
globals
.
bridge_hash
,
stream
);
switch_mutex_unlock
(
globals
.
mutex
);
}
#define FIFO_API_SYNTAX "list|list_verbose|count|debug|status|importance [<fifo name>]|reparse [del_all]"
SWITCH_STANDARD_API
(
fifo_api_function
)
SWITCH_STANDARD_API
(
fifo_api_function
)
{
{
int
len
=
0
;
int
len
=
0
;
...
@@ -3538,9 +3588,18 @@ SWITCH_STANDARD_API(fifo_api_function)
...
@@ -3538,9 +3588,18 @@ SWITCH_STANDARD_API(fifo_api_function)
goto
done
;
goto
done
;
}
}
if
(
!
strcasecmp
(
argv
[
0
],
"status"
))
{
node_dump
(
stream
);
goto
done
;
}
if
(
!
strcasecmp
(
argv
[
0
],
"debug"
))
{
if
(
!
strcasecmp
(
argv
[
0
],
"debug"
))
{
globals
.
debug
=
!
globals
.
debug
;
if
(
argv
[
1
])
{
stream
->
write_function
(
stream
,
"debug %s
\n
"
,
globals
.
debug
?
"on"
:
"off"
);
if
((
globals
.
debug
=
atoi
(
argv
[
1
]))
<
0
)
{
globals
.
debug
=
0
;
}
}
stream
->
write_function
(
stream
,
"debug %d
\n
"
,
globals
.
debug
);
goto
done
;
goto
done
;
}
}
...
@@ -4252,9 +4311,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
...
@@ -4252,9 +4311,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
globals
.
running
=
0
;
globals
.
running
=
0
;
/* Cleanup */
/* Cleanup */
if
(
globals
.
node_thread_running
)
{
stop_node_thread
();
stop_node_thread
();
}
while
(
globals
.
threads
)
{
while
(
globals
.
threads
)
{
switch_cond_next
();
switch_cond_next
();
...
...
src/switch_core_sqldb.c
浏览文件 @
9a667aeb
...
@@ -385,10 +385,12 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
...
@@ -385,10 +385,12 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
new_dbh
->
hash
=
switch_ci_hashfunc_default
(
db_str
,
&
hlen
);
new_dbh
->
hash
=
switch_ci_hashfunc_default
(
db_str
,
&
hlen
);
if
(
db
)
if
(
db
)
{
new_dbh
->
native_handle
.
core_db_dbh
=
db
;
new_dbh
->
native_handle
.
core_db_dbh
=
db
;
else
}
else
{
new_dbh
->
native_handle
.
odbc_dbh
=
odbc_dbh
;
new_dbh
->
native_handle
.
odbc_dbh
=
odbc_dbh
;
}
switch_mutex_init
(
&
new_dbh
->
mutex
,
SWITCH_MUTEX_UNNESTED
,
new_dbh
->
pool
);
switch_mutex_init
(
&
new_dbh
->
mutex
,
SWITCH_MUTEX_UNNESTED
,
new_dbh
->
pool
);
switch_set_string
(
new_dbh
->
creator
,
db_callsite_str
);
switch_set_string
(
new_dbh
->
creator
,
db_callsite_str
);
switch_mutex_lock
(
new_dbh
->
mutex
);
switch_mutex_lock
(
new_dbh
->
mutex
);
...
@@ -398,8 +400,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
...
@@ -398,8 +400,9 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
end
:
end
:
if
(
new_dbh
)
if
(
new_dbh
)
{
new_dbh
->
last_used
=
switch_epoch_time_now
(
NULL
);
new_dbh
->
last_used
=
switch_epoch_time_now
(
NULL
);
}
switch_mutex_unlock
(
sql_manager
.
dbh_mutex
);
switch_mutex_unlock
(
sql_manager
.
dbh_mutex
);
...
@@ -1605,6 +1608,7 @@ void switch_core_sqldb_stop(void)
...
@@ -1605,6 +1608,7 @@ void switch_core_sqldb_stop(void)
switch_thread_join
(
&
st
,
sql_manager
.
thread
);
switch_thread_join
(
&
st
,
sql_manager
.
thread
);
}
}
switch_cache_db_flush_handles
();
sql_close
(
0
);
sql_close
(
0
);
switch_core_hash_destroy
(
&
sql_manager
.
dbh_hash
);
switch_core_hash_destroy
(
&
sql_manager
.
dbh_hash
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论