Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bc3e1c9e
提交
bc3e1c9e
authored
7月 09, 2018
作者:
Anthony Minessale
提交者:
Muteesa Fred
7月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11225: [freeswitch-core] Crash in fs_cli #resolve
上级
8bacb499
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
51 行增加
和
29 行删除
+51
-29
fs_cli.c
libs/esl/fs_cli.c
+51
-29
没有找到文件。
libs/esl/fs_cli.c
浏览文件 @
bc3e1c9e
...
@@ -89,7 +89,7 @@ static int pcount = 0;
...
@@ -89,7 +89,7 @@ static int pcount = 0;
static
esl_handle_t
*
global_handle
;
static
esl_handle_t
*
global_handle
;
static
cli_profile_t
*
global_profile
;
static
cli_profile_t
*
global_profile
;
static
int
running
=
1
;
static
int
running
=
1
;
static
int
thread_running
=
0
;
static
int
thread_running
=
0
,
thread_up
=
0
,
check_up
=
0
;
static
char
*
filter_uuid
;
static
char
*
filter_uuid
;
static
char
*
logfilter
;
static
char
*
logfilter
;
static
int
timeout
=
0
;
static
int
timeout
=
0
;
...
@@ -671,40 +671,45 @@ static void clear_line(void)
...
@@ -671,40 +671,45 @@ static void clear_line(void)
static
void
redisplay
(
void
)
static
void
redisplay
(
void
)
{
{
esl_mutex_lock
(
MUTEX
);
{
#ifdef HAVE_LIBEDIT
#ifdef HAVE_LIBEDIT
#ifdef HAVE_DECL_EL_REFRESH
#ifdef
X
HAVE_DECL_EL_REFRESH
#ifdef HAVE_EL_WSET
#ifdef HAVE_EL_WSET
/* Current libedit versions don't implement EL_REFRESH in eln.c so
/* Current libedit versions don't implement EL_REFRESH in eln.c so
* use the wide version instead. */
* use the wide version instead. */
el_wset
(
el
,
EL_REFRESH
);
el_wset
(
el
,
EL_REFRESH
);
#else
#else
/* This will work on future libedit versions and versions built
/* This will work on future libedit versions and versions built
* without wide character support. */
* without wide character support. */
el_set
(
el
,
EL_REFRESH
);
el_set
(
el
,
EL_REFRESH
);
#endif
#endif
#else
#else
/* Old libedit versions don't implement EL_REFRESH at all so use
/* Old libedit versions don't implement EL_REFRESH at all so use
* our own implementation instead. */
* our own implementation instead. */
const
LineInfo
*
lf
=
el_line
(
el
);
const
LineInfo
*
lf
=
el_line
(
el
);
const
char
*
c
=
lf
->
buffer
;
const
char
*
c
=
lf
->
buffer
;
if
(
global_profile
->
batch_mode
)
return
;
if
(
global_profile
->
batch_mode
)
return
;
printf
(
"%s"
,
prompt_str
);
printf
(
"%s"
,
prompt_str
);
while
(
c
<
lf
->
lastchar
&&
*
c
)
{
while
(
c
<
lf
->
lastchar
&&
*
c
)
{
putchar
(
*
c
);
putchar
(
*
c
);
c
++
;
c
++
;
}
}
{
{
int
pos
=
(
int
)(
lf
->
cursor
-
lf
->
buffer
);
int
pos
=
(
int
)(
lf
->
cursor
-
lf
->
buffer
);
char
s1
[
12
],
s2
[
12
]
;
char
s1
[
12
],
s2
[
12
]
=
""
;
putchar
(
'\r'
);
snprintf
(
s1
,
sizeof
(
s1
),
"
\033
[%dC"
,
bare_prompt_str_len
);
putchar
(
'\r'
);
snprintf
(
s2
,
sizeof
(
s2
),
"
\033
[%dC"
,
pos
);
snprintf
(
s1
,
sizeof
(
s1
),
"
\033
[%dC"
,
bare_prompt_str_len
);
printf
(
"%s%s"
,
s1
,
s2
);
if
(
pos
)
snprintf
(
s2
,
sizeof
(
s2
),
"
\033
[%dC"
,
pos
);
}
printf
(
"%s%s"
,
s1
,
s2
);
fflush
(
stdout
);
}
return
;
fflush
(
stdout
)
;
#endif
#endif
#endif
#endif
}
esl_mutex_unlock
(
MUTEX
);
return
;
}
}
static
int
output_printf
(
const
char
*
fmt
,
...)
static
int
output_printf
(
const
char
*
fmt
,
...)
...
@@ -726,6 +731,9 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
...
@@ -726,6 +731,9 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
{
{
esl_handle_t
*
handle
=
(
esl_handle_t
*
)
obj
;
esl_handle_t
*
handle
=
(
esl_handle_t
*
)
obj
;
thread_running
=
1
;
thread_running
=
1
;
esl_mutex_lock
(
MUTEX
);
thread_up
=
1
;
esl_mutex_unlock
(
MUTEX
);
while
(
thread_running
&&
handle
->
connected
)
{
while
(
thread_running
&&
handle
->
connected
)
{
int
aok
=
1
;
int
aok
=
1
;
esl_status_t
status
;
esl_status_t
status
;
...
@@ -846,6 +854,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
...
@@ -846,6 +854,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
}
}
//sleep_ms(1);
//sleep_ms(1);
}
}
esl_mutex_lock
(
MUTEX
);
thread_up
=
0
;
esl_mutex_unlock
(
MUTEX
);
thread_running
=
0
;
thread_running
=
0
;
esl_log
(
ESL_LOG_DEBUG
,
"Thread Done
\n
"
);
esl_log
(
ESL_LOG_DEBUG
,
"Thread Done
\n
"
);
return
NULL
;
return
NULL
;
...
@@ -1165,8 +1177,10 @@ static unsigned char esl_console_complete(const char *buffer, const char *cursor
...
@@ -1165,8 +1177,10 @@ static unsigned char esl_console_complete(const char *buffer, const char *cursor
snprintf
(
cmd_str
,
sizeof
(
cmd_str
),
"api console_complete %s
\n\n
"
,
buf
);
snprintf
(
cmd_str
,
sizeof
(
cmd_str
),
"api console_complete %s
\n\n
"
,
buf
);
}
}
esl_mutex_lock
(
MUTEX
);
esl_send_recv
(
global_handle
,
cmd_str
);
esl_send_recv
(
global_handle
,
cmd_str
);
esl_mutex_unlock
(
MUTEX
);
if
(
global_handle
->
last_sr_event
&&
global_handle
->
last_sr_event
->
body
)
{
if
(
global_handle
->
last_sr_event
&&
global_handle
->
last_sr_event
->
body
)
{
char
*
r
=
global_handle
->
last_sr_event
->
body
;
char
*
r
=
global_handle
->
last_sr_event
->
body
;
char
*
w
,
*
p1
;
char
*
w
,
*
p1
;
...
@@ -1828,6 +1842,7 @@ int main(int argc, char *argv[])
...
@@ -1828,6 +1842,7 @@ int main(int argc, char *argv[])
output_printf
(
"%s
\n
"
,
handle
.
last_sr_reply
);
output_printf
(
"%s
\n
"
,
handle
.
last_sr_reply
);
while
(
running
>
0
)
{
while
(
running
>
0
)
{
int
r
;
int
r
;
#ifdef HAVE_LIBEDIT
#ifdef HAVE_LIBEDIT
if
(
!
(
global_profile
->
batch_mode
))
{
if
(
!
(
global_profile
->
batch_mode
))
{
line
=
el_gets
(
el
,
&
count
);
line
=
el_gets
(
el
,
&
count
);
...
@@ -1869,6 +1884,13 @@ int main(int argc, char *argv[])
...
@@ -1869,6 +1884,13 @@ int main(int argc, char *argv[])
global_handle
=
NULL
;
global_handle
=
NULL
;
thread_running
=
0
;
thread_running
=
0
;
do
{
esl_mutex_lock
(
MUTEX
);
check_up
=
thread_up
;
esl_mutex_unlock
(
MUTEX
);
sleep_ms
(
10
);
}
while
(
check_up
>
0
);
esl_mutex_destroy
(
&
MUTEX
);
esl_mutex_destroy
(
&
MUTEX
);
return
0
;
return
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论