Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
85be87ac
提交
85be87ac
authored
6月 06, 2021
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ChannelSocket and PayloadChannelSocket: use closed flag as done in many other classes
上级
d6bb28ab
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
28 行增加
和
6 行删除
+28
-6
ChannelSocket.hpp
worker/include/Channel/ChannelSocket.hpp
+1
-0
PayloadChannelSocket.hpp
worker/include/PayloadChannel/PayloadChannelSocket.hpp
+1
-0
ChannelSocket.cpp
worker/src/Channel/ChannelSocket.cpp
+10
-2
PayloadChannelSocket.cpp
worker/src/PayloadChannel/PayloadChannelSocket.cpp
+10
-2
lib.cpp
worker/src/lib.cpp
+6
-2
没有找到文件。
worker/include/Channel/ChannelSocket.hpp
浏览文件 @
85be87ac
...
...
@@ -80,6 +80,7 @@ namespace Channel
// Passed by argument.
Listener
*
listener
{
nullptr
};
// Others.
bool
closed
{
false
};
ConsumerSocket
consumerSocket
;
ProducerSocket
producerSocket
;
uint8_t
*
writeBuffer
;
...
...
worker/include/PayloadChannel/PayloadChannelSocket.hpp
浏览文件 @
85be87ac
...
...
@@ -89,6 +89,7 @@ namespace PayloadChannel
// Passed by argument.
Listener
*
listener
{
nullptr
};
// Others.
bool
closed
{
false
};
ConsumerSocket
consumerSocket
;
ProducerSocket
producerSocket
;
PayloadChannel
::
Notification
*
ongoingNotification
{
nullptr
};
...
...
worker/src/Channel/ChannelSocket.cpp
浏览文件 @
85be87ac
...
...
@@ -34,12 +34,20 @@ namespace Channel
MS_TRACE_STD
();
std
::
free
(
this
->
writeBuffer
);
if
(
!
this
->
closed
)
Close
();
}
void
ChannelSocket
::
Close
()
{
MS_TRACE_STD
();
if
(
this
->
closed
)
return
;
this
->
closed
=
true
;
this
->
consumerSocket
.
Close
();
this
->
producerSocket
.
Close
();
}
...
...
@@ -55,7 +63,7 @@ namespace Channel
{
MS_TRACE_STD
();
if
(
this
->
producerSocket
.
IsClosed
()
)
if
(
this
->
closed
)
return
;
std
::
string
message
=
jsonMessage
.
dump
();
...
...
@@ -74,7 +82,7 @@ namespace Channel
{
MS_TRACE_STD
();
if
(
this
->
producerSocket
.
IsClosed
()
)
if
(
this
->
closed
)
return
;
if
(
messageLen
>
NsPayloadMaxLen
)
...
...
worker/src/PayloadChannel/PayloadChannelSocket.cpp
浏览文件 @
85be87ac
...
...
@@ -36,12 +36,20 @@ namespace PayloadChannel
std
::
free
(
this
->
writeBuffer
);
delete
this
->
ongoingNotification
;
if
(
!
this
->
closed
)
Close
();
}
void
PayloadChannelSocket
::
Close
()
{
MS_TRACE_STD
();
if
(
this
->
closed
)
return
;
this
->
closed
=
true
;
this
->
consumerSocket
.
Close
();
this
->
producerSocket
.
Close
();
}
...
...
@@ -57,7 +65,7 @@ namespace PayloadChannel
{
MS_TRACE
();
if
(
this
->
producerSocket
.
IsClosed
()
)
if
(
this
->
closed
)
return
;
std
::
string
message
=
jsonMessage
.
dump
();
...
...
@@ -83,7 +91,7 @@ namespace PayloadChannel
{
MS_TRACE_STD
();
if
(
this
->
c
onsumerSocket
.
IsClosed
()
)
if
(
this
->
c
losed
)
return
;
std
::
string
message
=
jsonMessage
.
dump
();
...
...
worker/src/lib.cpp
浏览文件 @
85be87ac
...
...
@@ -40,10 +40,14 @@ extern "C" int run_worker(
// Initialize libuv stuff (we need it for the Channel).
DepLibUV
::
ClassInit
();
// Channel socket.
// Channel socket. If Worker instance runs properly, this socket is closed by
// it in its destructor. Otherwise it's closed here by also letting libuv
// deallocate its UV handles.
std
::
unique_ptr
<
Channel
::
ChannelSocket
>
channel
{
nullptr
};
// PayloadChannel socket.
// PayloadChannel socket. If Worker instance runs properly, this socket is
// closed by it in its destructor. Otherwise it's closed here by also letting
// libuv deallocate its UV handles.
std
::
unique_ptr
<
PayloadChannel
::
PayloadChannelSocket
>
payloadChannel
{
nullptr
};
try
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论