Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
90da341a
提交
90da341a
authored
7月 20, 2010
作者:
Mathieu Rene
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix git screwup
上级
5e07bd33
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
23 行删除
+17
-23
esl.c
libs/esl/src/esl.c
+13
-20
esl.h
libs/esl/src/include/esl.h
+4
-3
没有找到文件。
libs/esl/src/esl.c
浏览文件 @
90da341a
...
...
@@ -607,15 +607,14 @@ ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_list
}
ESL_DECLARE
(
esl_status_t
)
esl_connect_timeout
(
esl_handle_t
*
handle
,
const
char
*
host
,
esl_port_t
port
,
const
char
*
user
,
const
char
*
password
,
long
timeout
)
ESL_DECLARE
(
esl_status_t
)
esl_connect_timeout
(
esl_handle_t
*
handle
,
const
char
*
host
,
esl_port_t
port
,
const
char
*
user
,
const
char
*
password
,
uint32_t
timeout
)
{
char
sendbuf
[
256
];
int
rval
=
0
;
const
char
*
hval
;
struct
addrinfo
hints
=
{
0
},
*
result
;
#ifndef WIN32
int
fd_flags
;
#
else
#
ifdef WIN32
WORD
wVersionRequested
=
MAKEWORD
(
2
,
0
);
WSADATA
wsaData
;
int
err
=
WSAStartup
(
wVersionRequested
,
&
wsaData
);
...
...
@@ -650,7 +649,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
handle
->
sockaddr
.
sin_family
=
AF_INET
;
handle
->
sockaddr
.
sin_port
=
htons
(
port
);
if
(
timeout
!=
-
1
)
{
if
(
timeout
)
{
#ifdef WIN32
u_long
arg
=
1
;
if
(
ioctlsocket
(
handle
->
sock
,
FIONBIO
,
&
arg
)
==
SOCKET_ERROR
)
{
...
...
@@ -668,22 +667,13 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
rval
=
connect
(
handle
->
sock
,
(
struct
sockaddr
*
)
&
handle
->
sockaddr
,
sizeof
(
handle
->
sockaddr
));
if
(
timeout
!=
-
1
)
{
if
(
timeout
)
{
fd_set
wfds
;
struct
timeval
tv
;
struct
timeval
tv
=
{
timeout
/
1000
,
(
timeout
%
1000
)
*
1000
}
;
int
r
;
tv
.
tv_sec
=
timeout
/
1000
;
tv
.
tv_usec
=
(
timeout
%
1000
)
*
1000
;
FD_ZERO
(
&
wfds
);
#ifdef WIN32
#pragma warning( push )
#pragma warning( disable : 4127 )
FD_SET
(
handle
->
sock
,
&
wfds
);
#pragma warning( pop )
#else
FD_SET
(
handle
->
sock
,
&
wfds
);
#endif
r
=
select
(
handle
->
sock
+
1
,
NULL
,
&
wfds
,
NULL
,
&
tv
);
...
...
@@ -723,7 +713,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
handle
->
connected
=
1
;
if
(
esl_recv
(
handle
))
{
if
(
esl_recv
_timed
(
handle
,
timeout
))
{
snprintf
(
handle
->
err
,
sizeof
(
handle
->
err
),
"Connection Error"
);
goto
fail
;
}
...
...
@@ -744,7 +734,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
esl_send
(
handle
,
sendbuf
);
if
(
esl_recv
(
handle
))
{
if
(
esl_recv
_timed
(
handle
,
timeout
))
{
snprintf
(
handle
->
err
,
sizeof
(
handle
->
err
),
"Authentication Error"
);
goto
fail
;
}
...
...
@@ -810,6 +800,10 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
struct
timeval
tv
=
{
0
};
int
max
,
activity
;
esl_status_t
status
=
ESL_SUCCESS
;
if
(
!
ms
)
{
return
esl_recv_event
(
handle
,
check_q
,
save_event
);
}
if
(
!
handle
||
!
handle
->
connected
||
handle
->
sock
==
ESL_SOCK_INVALID
)
{
return
ESL_FAIL
;
...
...
@@ -826,7 +820,6 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
tv
.
tv_usec
=
ms
*
1000
;
FD_ZERO
(
&
rfds
);
FD_ZERO
(
&
efds
);
...
...
@@ -1152,7 +1145,7 @@ ESL_DECLARE(esl_status_t) esl_send(esl_handle_t *handle, const char *cmd)
}
ESL_DECLARE
(
esl_status_t
)
esl_send_recv
(
esl_handle_t
*
handle
,
const
char
*
cmd
)
ESL_DECLARE
(
esl_status_t
)
esl_send_recv
_timed
(
esl_handle_t
*
handle
,
const
char
*
cmd
,
uint32_t
ms
)
{
const
char
*
hval
;
esl_status_t
status
;
...
...
@@ -1182,7 +1175,7 @@ ESL_DECLARE(esl_status_t) esl_send_recv(esl_handle_t *handle, const char *cmd)
recv
:
status
=
esl_recv_event
(
handle
,
0
,
&
handle
->
last_sr_event
);
status
=
esl_recv_event
_timed
(
handle
,
ms
,
0
,
&
handle
->
last_sr_event
);
if
(
handle
->
last_sr_event
)
{
char
*
ct
=
esl_event_get_header
(
handle
->
last_sr_event
,
"content-type"
);
...
...
libs/esl/src/include/esl.h
浏览文件 @
90da341a
...
...
@@ -389,8 +389,8 @@ ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event
\param password FreeSWITCH server password
\param timeout Connection timeout, in miliseconds
*/
ESL_DECLARE
(
esl_status_t
)
esl_connect_timeout
(
esl_handle_t
*
handle
,
const
char
*
host
,
esl_port_t
port
,
const
char
*
user
,
const
char
*
password
,
long
timeout
);
#define esl_connect(_handle, _host, _port, _user, _password) esl_connect_timeout(_handle, _host, _port, _user, _password,
-1
)
ESL_DECLARE
(
esl_status_t
)
esl_connect_timeout
(
esl_handle_t
*
handle
,
const
char
*
host
,
esl_port_t
port
,
const
char
*
user
,
const
char
*
password
,
uint32_t
timeout
);
#define esl_connect(_handle, _host, _port, _user, _password) esl_connect_timeout(_handle, _host, _port, _user, _password,
0
)
/*!
\brief Disconnect a handle
...
...
@@ -423,7 +423,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
\param handle Handle to be used
\param cmd Raw command to send
*/
ESL_DECLARE
(
esl_status_t
)
esl_send_recv
(
esl_handle_t
*
handle
,
const
char
*
cmd
);
ESL_DECLARE
(
esl_status_t
)
esl_send_recv_timed
(
esl_handle_t
*
handle
,
const
char
*
cmd
,
uint32_t
ms
);
#define esl_send_recv(_handle, _cmd) esl_send_recv_timed(_handle, _cmd, 0)
/*!
\brief Applies a filter to received events
\param handle Handle to apply the filter to
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论