Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2cdae46b
提交
2cdae46b
authored
4月 29, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-6476 regression where sock would sometimes drop while reading logical frames
上级
af32ca00
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
18 行删除
+15
-18
.update
libs/sofia-sip/.update
+1
-1
ws.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
+13
-16
ws.h
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
+1
-1
没有找到文件。
libs/sofia-sip/.update
浏览文件 @
2cdae46b
T
hu Apr 17 04:32:56 C
DT 2014
T
ue Apr 29 18:23:46 E
DT 2014
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
浏览文件 @
2cdae46b
...
...
@@ -11,6 +11,9 @@
#define ms_sleep(x) Sleep( x );
#endif
#define WS_BLOCK 1
#define WS_NOBLOCK 0
#define SHA1_HASH_SIZE 20
struct
ws_globals_s
ws_globals
;
...
...
@@ -242,7 +245,7 @@ int ws_handshake(wsh_t *wsh)
return
-
3
;
}
while
((
bytes
=
ws_raw_read
(
wsh
,
wsh
->
buffer
+
wsh
->
datalen
,
wsh
->
buflen
-
wsh
->
datalen
))
>
0
)
{
while
((
bytes
=
ws_raw_read
(
wsh
,
wsh
->
buffer
+
wsh
->
datalen
,
wsh
->
buflen
-
wsh
->
datalen
,
WS_BLOCK
))
>
0
)
{
wsh
->
datalen
+=
bytes
;
if
(
strstr
(
wsh
->
buffer
,
"
\r\n\r\n
"
)
||
strstr
(
wsh
->
buffer
,
"
\n\n
"
))
{
break
;
...
...
@@ -315,7 +318,7 @@ int ws_handshake(wsh_t *wsh)
}
ssize_t
ws_raw_read
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
)
ssize_t
ws_raw_read
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
,
int
block
)
{
ssize_t
r
;
int
err
=
0
;
...
...
@@ -323,15 +326,13 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
if
(
wsh
->
ssl
)
{
do
{
r
=
SSL_read
(
wsh
->
ssl
,
data
,
bytes
);
#ifndef _MSC_VER
if
(
wsh
->
x
++
)
usleep
(
10000
);
#else
if
(
wsh
->
x
++
)
Sleep
(
10
);
#endif
ms_sleep
(
10
);
if
(
r
==
-
1
)
{
err
=
SSL_get_error
(
wsh
->
ssl
,
r
);
if
(
wsh
->
handshake
&&
err
==
SSL_ERROR_WANT_READ
)
{
if
(
!
block
&&
err
==
SSL_ERROR_WANT_READ
)
{
r
=
-
2
;
goto
end
;
}
...
...
@@ -344,11 +345,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
do
{
r
=
recv
(
wsh
->
sock
,
data
,
bytes
,
0
);
#ifndef _MSC_VER
if
(
wsh
->
x
++
)
usleep
(
10000
);
#else
if
(
wsh
->
x
++
)
Sleep
(
10
);
#endif
ms_sleep
(
10
);
}
while
(
r
==
-
1
&&
xp_is_blocking
(
xp_errno
())
&&
wsh
->
x
<
100
);
if
(
wsh
->
x
>=
100
)
{
...
...
@@ -633,7 +630,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
return
ws_close
(
wsh
,
WS_PROTO_ERR
);
}
if
((
wsh
->
datalen
=
ws_raw_read
(
wsh
,
wsh
->
buffer
,
9
))
<
0
)
{
if
((
wsh
->
datalen
=
ws_raw_read
(
wsh
,
wsh
->
buffer
,
9
,
WS_NOBLOCK
))
<
0
)
{
if
(
wsh
->
datalen
==
-
2
)
{
return
-
2
;
}
...
...
@@ -641,7 +638,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
}
if
(
wsh
->
datalen
<
need
)
{
if
((
wsh
->
datalen
+=
ws_raw_read
(
wsh
,
wsh
->
buffer
+
wsh
->
datalen
,
9
-
wsh
->
datalen
))
<
need
)
{
if
((
wsh
->
datalen
+=
ws_raw_read
(
wsh
,
wsh
->
buffer
+
wsh
->
datalen
,
9
-
wsh
->
datalen
,
WS_BLOCK
))
<
need
)
{
/* too small - protocol err */
return
ws_close
(
wsh
,
WS_PROTO_ERR
);
}
...
...
@@ -733,7 +730,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
wsh
->
rplen
=
wsh
->
plen
-
need
;
while
(
need
)
{
ssize_t
r
=
ws_raw_read
(
wsh
,
wsh
->
payload
+
wsh
->
rplen
,
need
);
ssize_t
r
=
ws_raw_read
(
wsh
,
wsh
->
payload
+
wsh
->
rplen
,
need
,
WS_BLOCK
);
if
(
r
<
1
)
{
/* invalid read - protocol err .. */
...
...
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
浏览文件 @
2cdae46b
...
...
@@ -95,7 +95,7 @@ ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc);
ssize_t
ws_feed_buf
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
);
ssize_t
ws_raw_read
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
);
ssize_t
ws_raw_read
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
,
int
block
);
ssize_t
ws_raw_write
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
);
ssize_t
ws_read_frame
(
wsh_t
*
wsh
,
ws_opcode_t
*
oc
,
uint8_t
**
data
);
ssize_t
ws_write_frame
(
wsh_t
*
wsh
,
ws_opcode_t
oc
,
void
*
data
,
size_t
bytes
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论