Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
afc18668
提交
afc18668
authored
6月 26, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak sip ws code to avoid double free
上级
a6f5efae
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
21 行增加
和
27 行删除
+21
-27
.update
libs/sofia-sip/.update
+1
-1
tport_type_ws.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
+16
-18
tport_ws.h
libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h
+1
-1
ws.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
+2
-6
ws.h
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
+1
-1
没有找到文件。
libs/sofia-sip/.update
浏览文件 @
afc18668
Tue Jun 25 09:28:40 C
DT 2013
Wed Jun 26 12:43:51 E
DT 2013
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
浏览文件 @
afc18668
...
@@ -207,23 +207,14 @@ int tport_recv_stream_ws(tport_t *self)
...
@@ -207,23 +207,14 @@ int tport_recv_stream_ws(tport_t *self)
int
err
;
int
err
;
msg_iovec_t
iovec
[
msg_n_fragments
]
=
{{
0
}};
msg_iovec_t
iovec
[
msg_n_fragments
]
=
{{
0
}};
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
wsh_t
*
ws
=
wstp
->
ws
;
tport_ws_primary_t
*
wspri
=
(
tport_ws_primary_t
*
)
self
->
tp_pri
;
uint8_t
*
data
;
uint8_t
*
data
;
ws_opcode_t
oc
;
ws_opcode_t
oc
;
if
(
wstp
->
ws_initialized
<
0
)
{
if
(
wstp
->
ws_initialized
<
0
)
{
return
-
1
;
return
-
1
;
}
else
if
(
wstp
->
ws_initialized
==
0
)
{
if
(
ws_init
(
ws
,
self
->
tp_socket
,
65336
,
wstp
->
ws_secure
?
wspri
->
ssl_ctx
:
NULL
,
0
)
==
-
2
)
{
return
2
;
}
wstp
->
ws_initialized
=
1
;
self
->
tp_pre_framed
=
1
;
return
1
;
}
}
N
=
ws_read_frame
(
ws
,
&
oc
,
&
data
);
N
=
ws_read_frame
(
&
wstp
->
ws
,
&
oc
,
&
data
);
if
(
N
==
-
2
)
{
if
(
N
==
-
2
)
{
return
2
;
return
2
;
...
@@ -276,7 +267,6 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
...
@@ -276,7 +267,6 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
size_t
i
,
j
,
n
,
m
,
size
=
0
;
size_t
i
,
j
,
n
,
m
,
size
=
0
;
ssize_t
nerror
;
ssize_t
nerror
;
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
wsh_t
*
ws
=
wstp
->
ws
;
enum
{
WSBUFSIZE
=
2048
};
enum
{
WSBUFSIZE
=
2048
};
...
@@ -311,10 +301,10 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
...
@@ -311,10 +301,10 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
iov
[
j
].
siv_base
=
buf
,
iov
[
j
].
siv_len
=
m
;
iov
[
j
].
siv_base
=
buf
,
iov
[
j
].
siv_len
=
m
;
}
}
nerror
=
ws_feed_buf
(
ws
,
buf
,
m
);
nerror
=
ws_feed_buf
(
&
wstp
->
ws
,
buf
,
m
);
SU_DEBUG_9
((
"tport_ws_writevec: vec %p %p %lu ("
MOD_ZD
")
\n
"
,
SU_DEBUG_9
((
"tport_ws_writevec: vec %p %p %lu ("
MOD_ZD
")
\n
"
,
(
void
*
)
ws
,
(
void
*
)
iov
[
i
].
siv_base
,
(
LU
)
iov
[
i
].
siv_len
,
(
void
*
)
&
wstp
->
ws
,
(
void
*
)
iov
[
i
].
siv_base
,
(
LU
)
iov
[
i
].
siv_len
,
nerror
));
nerror
));
if
(
nerror
==
-
1
)
{
if
(
nerror
==
-
1
)
{
...
@@ -333,7 +323,7 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
...
@@ -333,7 +323,7 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
break
;
break
;
}
}
ws_send_buf
(
ws
,
WSOC_TEXT
);
ws_send_buf
(
&
wstp
->
ws
,
WSOC_TEXT
);
return
size
;
return
size
;
...
@@ -453,6 +443,15 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
...
@@ -453,6 +443,15 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
if
(
wspri
->
ws_secure
)
wstp
->
ws_secure
=
1
;
if
(
wspri
->
ws_secure
)
wstp
->
ws_secure
=
1
;
memset
(
&
wstp
->
ws
,
0
,
sizeof
(
wstp
->
ws
));
if
(
ws_init
(
&
wstp
->
ws
,
socket
,
65336
,
wstp
->
ws_secure
?
wspri
->
ssl_ctx
:
NULL
,
0
)
<
0
)
{
return
*
return_reason
=
"WS_INIT"
,
-
1
;
}
wstp
->
ws_initialized
=
1
;
self
->
tp_pre_framed
=
1
;
return
0
;
return
0
;
}
}
...
@@ -461,10 +460,9 @@ static void tport_ws_deinit_secondary(tport_t *self)
...
@@ -461,10 +460,9 @@ static void tport_ws_deinit_secondary(tport_t *self)
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
tport_ws_t
*
wstp
=
(
tport_ws_t
*
)
self
;
if
(
wstp
->
ws_initialized
==
1
)
{
if
(
wstp
->
ws_initialized
==
1
)
{
wsh_t
*
wsh
=
wstp
->
ws
;
SU_DEBUG_1
((
"%p destroy ws%s transport %p.
\n
"
,
(
void
*
)
self
,
wstp
->
ws_secure
?
"s"
:
""
,
(
void
*
)
&
wstp
->
ws
));
SU_DEBUG_1
((
"%p destroy ws%s transport %p.
\n
"
,
(
void
*
)
self
,
wstp
->
ws_secure
?
"s"
:
""
,
(
void
*
)
wsh
));
ws_destroy
(
&
wstp
->
ws
);
ws_destroy
(
&
wsh
);
wstp
->
ws_initialized
=
-
1
;
wstp
->
ws_initialized
=
1
;
}
}
}
}
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h
浏览文件 @
afc18668
...
@@ -55,7 +55,7 @@ typedef enum {
...
@@ -55,7 +55,7 @@ typedef enum {
typedef
struct
tport_ws_s
{
typedef
struct
tport_ws_s
{
tport_t
wstp_tp
[
1
];
tport_t
wstp_tp
[
1
];
wsh_t
ws
[
1
]
;
wsh_t
ws
;
char
*
wstp_buffer
;
char
*
wstp_buffer
;
SU_S8_T
ws_initialized
;
SU_S8_T
ws_initialized
;
unsigned
ws_secure
:
1
;
unsigned
ws_secure
:
1
;
...
...
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
浏览文件 @
afc18668
...
@@ -402,17 +402,13 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
...
@@ -402,17 +402,13 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
return
0
;
return
0
;
}
}
void
ws_destroy
(
wsh_t
*
*
wshp
)
void
ws_destroy
(
wsh_t
*
wsh
)
{
{
wsh_t
*
wsh
;
if
(
!
wsh
p
||
!
*
wshp
)
{
if
(
!
wsh
)
{
return
;
return
;
}
}
wsh
=
*
wshp
;
*
wshp
=
NULL
;
if
(
!
wsh
->
down
)
{
if
(
!
wsh
->
down
)
{
ws_close
(
wsh
,
WS_NONE
);
ws_close
(
wsh
,
WS_NONE
);
}
}
...
...
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
浏览文件 @
afc18668
...
@@ -85,7 +85,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
...
@@ -85,7 +85,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
issize_t
ws_write_frame
(
wsh_t
*
wsh
,
ws_opcode_t
oc
,
void
*
data
,
size_t
bytes
);
issize_t
ws_write_frame
(
wsh_t
*
wsh
,
ws_opcode_t
oc
,
void
*
data
,
size_t
bytes
);
int
ws_init
(
wsh_t
*
wsh
,
ws_socket_t
sock
,
size_t
buflen
,
SSL_CTX
*
ssl_ctx
,
int
close_sock
);
int
ws_init
(
wsh_t
*
wsh
,
ws_socket_t
sock
,
size_t
buflen
,
SSL_CTX
*
ssl_ctx
,
int
close_sock
);
issize_t
ws_close
(
wsh_t
*
wsh
,
int16_t
reason
);
issize_t
ws_close
(
wsh_t
*
wsh
,
int16_t
reason
);
void
ws_destroy
(
wsh_t
*
*
wshp
);
void
ws_destroy
(
wsh_t
*
wsh
);
void
init_ssl
(
void
);
void
init_ssl
(
void
);
void
deinit_ssl
(
void
);
void
deinit_ssl
(
void
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论