Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a71b199d
提交
a71b199d
authored
6月 20, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ref counting issue in tcp,tls,wss transports
上级
48532bd6
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
63 行增加
和
33 行删除
+63
-33
.update
libs/sofia-sip/.update
+1
-1
nua_registrar.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
+5
-3
tport_type_ws.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
+17
-11
ws.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
+39
-18
ws.h
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
+1
-0
没有找到文件。
libs/sofia-sip/.update
浏览文件 @
a71b199d
Wed Jun 19 12:25:57 C
DT 2013
Thu Jun 20 01:13:57 E
DT 2013
libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
浏览文件 @
a71b199d
...
@@ -226,8 +226,10 @@ nua_registrar_server_preprocess(nua_server_request_t *sr)
...
@@ -226,8 +226,10 @@ nua_registrar_server_preprocess(nua_server_request_t *sr)
tport
=
nta_incoming_transport
(
nh
->
nh_nua
->
nua_nta
,
sr
->
sr_irq
,
sr
->
sr_request
.
msg
);
tport
=
nta_incoming_transport
(
nh
->
nh_nua
->
nua_nta
,
sr
->
sr_irq
,
sr
->
sr_request
.
msg
);
if
(
!
tport_is_tcp
(
tport
))
if
(
!
tport_is_tcp
(
tport
))
{
tport_unref
(
tport
);
return
0
;
return
0
;
}
du
=
nua_dialog_usage_get
(
ds
,
nua_registrar_usage
,
NULL
);
du
=
nua_dialog_usage_get
(
ds
,
nua_registrar_usage
,
NULL
);
if
(
du
==
NULL
)
if
(
du
==
NULL
)
...
@@ -243,7 +245,7 @@ nua_registrar_server_preprocess(nua_server_request_t *sr)
...
@@ -243,7 +245,7 @@ nua_registrar_server_preprocess(nua_server_request_t *sr)
tport_unref
(
ru
->
tport
),
ru
->
tport
=
NULL
;
tport_unref
(
ru
->
tport
),
ru
->
tport
=
NULL
;
}
}
ru
->
tport
=
tport
_ref
(
tport
)
;
ru
->
tport
=
tport
;
ru
->
pending
=
tport_pend
(
tport
,
NULL
,
registrar_tport_error
,
nh
);
ru
->
pending
=
tport_pend
(
tport
,
NULL
,
registrar_tport_error
,
nh
);
tport_set_params
(
tport
,
tport_set_params
(
tport
,
...
...
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
浏览文件 @
a71b199d
...
@@ -185,6 +185,7 @@ tport_vtable_t const tport_wss_client_vtable =
...
@@ -185,6 +185,7 @@ tport_vtable_t const tport_wss_client_vtable =
static
void
tport_ws_deinit_primary
(
tport_primary_t
*
pri
)
static
void
tport_ws_deinit_primary
(
tport_primary_t
*
pri
)
{
{
tport_ws_primary_t
*
wspri
=
(
tport_ws_primary_t
*
)
pri
;
tport_ws_primary_t
*
wspri
=
(
tport_ws_primary_t
*
)
pri
;
if
(
wspri
->
ssl_ctx
)
{
if
(
wspri
->
ssl_ctx
)
{
SSL_CTX_free
(
wspri
->
ssl_ctx
);
SSL_CTX_free
(
wspri
->
ssl_ctx
);
wspri
->
ssl_ctx
=
NULL
;
wspri
->
ssl_ctx
=
NULL
;
...
@@ -211,7 +212,9 @@ int tport_recv_stream_ws(tport_t *self)
...
@@ -211,7 +212,9 @@ int tport_recv_stream_ws(tport_t *self)
uint8_t
*
data
;
uint8_t
*
data
;
ws_opcode_t
oc
;
ws_opcode_t
oc
;
if
(
!
wstp
->
ws_initialized
)
{
if
(
wstp
->
ws_initialized
<
0
)
{
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
)
{
if
(
ws_init
(
ws
,
self
->
tp_socket
,
65336
,
wstp
->
ws_secure
?
wspri
->
ssl_ctx
:
NULL
,
0
)
==
-
2
)
{
return
2
;
return
2
;
}
}
...
@@ -226,16 +229,17 @@ int tport_recv_stream_ws(tport_t *self)
...
@@ -226,16 +229,17 @@ int tport_recv_stream_ws(tport_t *self)
return
2
;
return
2
;
}
}
if
((
N
==
-
1000
)
||
(
N
==
0
))
{
if
((
N
==
-
1000
)
||
(
N
==
0
))
{
if
(
self
->
tp_msg
)
if
(
self
->
tp_msg
)
{
msg_recv_commit
(
self
->
tp_msg
,
0
,
1
);
msg_recv_commit
(
self
->
tp_msg
,
0
,
1
);
}
return
0
;
/* End of stream */
return
0
;
/* End of stream */
}
}
if
(
N
<
0
)
{
if
(
N
<
0
)
{
err
=
su_errno
()
;
err
=
errno
=
EHOSTDOWN
;
SU_DEBUG_1
((
"%s(%p): su_getmsgsize(): %s (%d)
\n
"
,
__func__
,
(
void
*
)
self
,
SU_DEBUG_1
((
"%s(%p): su_getmsgsize(): %s (%d)
\n
"
,
__func__
,
(
void
*
)
self
,
su_strerror
(
err
),
err
));
su_strerror
(
err
),
err
));
return
0
;
;
return
0
;
}
}
veclen
=
tport_recv_iovec
(
self
,
&
self
->
tp_msg
,
iovec
,
N
,
0
);
veclen
=
tport_recv_iovec
(
self
,
&
self
->
tp_msg
,
iovec
,
N
,
0
);
...
@@ -456,9 +460,11 @@ static void tport_ws_deinit_secondary(tport_t *self)
...
@@ -456,9 +460,11 @@ 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
)
{
if
(
wstp
->
ws_initialized
==
1
)
{
ws_close
(
wstp
->
ws
,
WS_NONE
);
wsh_t
*
wsh
=
wstp
->
ws
;
wstp
->
ws_initialized
=
0
;
SU_DEBUG_1
((
"%p destroy ws%s transport %p.
\n
"
,
(
void
*
)
self
,
wstp
->
ws_secure
?
"s"
:
""
,
(
void
*
)
wsh
));
ws_destroy
(
&
wsh
);
wstp
->
ws_initialized
=
-
1
;
}
}
}
}
...
...
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
浏览文件 @
a71b199d
...
@@ -402,23 +402,26 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
...
@@ -402,23 +402,26 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
return
0
;
return
0
;
}
}
issize_t
ws_close
(
wsh_t
*
wsh
,
int16_t
reason
)
void
ws_destroy
(
wsh_t
**
wshp
)
{
{
wsh_t
*
wsh
;
if
(
wsh
->
down
)
{
if
(
!
wshp
||
!
*
wshp
)
{
return
-
1
;
return
;
}
}
wsh
->
down
++
;
if
(
reason
)
{
wsh
=
*
wshp
;
uint16_t
*
u16
;
*
wshp
=
NULL
;
uint8_t
fr
[
4
]
=
{
WSOC_CLOSE
|
0x80
,
2
,
0
};
u16
=
(
uint16_t
*
)
&
fr
[
2
];
if
(
!
wsh
->
down
)
{
*
u16
=
htons
((
int16_t
)
reason
);
ws_close
(
wsh
,
WS_NONE
);
ws_raw_write
(
wsh
,
fr
,
4
);
}
}
if
(
wsh
->
down
>
1
)
{
return
;
}
wsh
->
down
=
2
;
if
(
wsh
->
ssl
)
{
if
(
wsh
->
ssl
)
{
int
code
;
int
code
;
...
@@ -430,12 +433,6 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
...
@@ -430,12 +433,6 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
wsh
->
ssl
=
NULL
;
wsh
->
ssl
=
NULL
;
}
}
if
(
wsh
->
close_sock
)
{
close
(
wsh
->
sock
);
}
wsh
->
sock
=
ws_sock_invalid
;
if
(
wsh
->
buffer
)
{
if
(
wsh
->
buffer
)
{
free
(
wsh
->
buffer
);
free
(
wsh
->
buffer
);
wsh
->
buffer
=
NULL
;
wsh
->
buffer
=
NULL
;
...
@@ -445,7 +442,31 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
...
@@ -445,7 +442,31 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
free
(
wsh
->
wbuffer
);
free
(
wsh
->
wbuffer
);
wsh
->
wbuffer
=
NULL
;
wsh
->
wbuffer
=
NULL
;
}
}
}
issize_t
ws_close
(
wsh_t
*
wsh
,
int16_t
reason
)
{
if
(
wsh
->
down
)
{
return
-
1
;
}
wsh
->
down
=
1
;
if
(
reason
&&
wsh
->
sock
!=
ws_sock_invalid
)
{
uint16_t
*
u16
;
uint8_t
fr
[
4
]
=
{
WSOC_CLOSE
|
0x80
,
2
,
0
};
u16
=
(
uint16_t
*
)
&
fr
[
2
];
*
u16
=
htons
((
int16_t
)
reason
);
ws_raw_write
(
wsh
,
fr
,
4
);
}
if
(
wsh
->
close_sock
)
{
close
(
wsh
->
sock
);
}
wsh
->
sock
=
ws_sock_invalid
;
return
reason
*
-
1
;
return
reason
*
-
1
;
...
...
libs/sofia-sip/libsofia-sip-ua/tport/ws.h
浏览文件 @
a71b199d
...
@@ -85,6 +85,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
...
@@ -85,6 +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
init_ssl
(
void
);
void
init_ssl
(
void
);
void
deinit_ssl
(
void
);
void
deinit_ssl
(
void
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论