Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
96b2665a
提交
96b2665a
authored
9月 02, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove length check on Rust side, we are sharing memory anyway so those do not make any sense now
上级
c53d4947
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
1 行增加
和
39 行删除
+1
-39
worker.rs
rust/src/worker.rs
+1
-7
channel.rs
rust/src/worker/channel.rs
+0
-13
payload_channel.rs
rust/src/worker/payload_channel.rs
+0
-19
没有找到文件。
rust/src/worker.rs
浏览文件 @
96b2665a
...
@@ -39,18 +39,12 @@ uuid_based_wrapper_type!(
...
@@ -39,18 +39,12 @@ uuid_based_wrapper_type!(
WorkerId
WorkerId
);
);
/// Error that caused request to mediasoup-worker
thread
to fail.
/// Error that caused request to mediasoup-worker
request
to fail.
#[derive(Debug,
Error,
Eq,
PartialEq)]
#[derive(Debug,
Error,
Eq,
PartialEq)]
pub
enum
RequestError
{
pub
enum
RequestError
{
/// Channel already closed.
/// Channel already closed.
#[error(
"Channel already closed"
)]
#[error(
"Channel already closed"
)]
ChannelClosed
,
ChannelClosed
,
/// Message is too long.
#[error(
"Message is too long"
)]
MessageTooLong
,
/// Payload is too long.
#[error(
"Payload is too long"
)]
PayloadTooLong
,
/// Request timed out.
/// Request timed out.
#[error(
"Request timed out"
)]
#[error(
"Request timed out"
)]
TimedOut
,
TimedOut
,
...
...
rust/src/worker/channel.rs
浏览文件 @
96b2665a
...
@@ -15,8 +15,6 @@ use std::fmt::Debug;
...
@@ -15,8 +15,6 @@ use std::fmt::Debug;
use
std
::
sync
::{
Arc
,
Weak
};
use
std
::
sync
::{
Arc
,
Weak
};
use
std
::
time
::
Duration
;
use
std
::
time
::
Duration
;
const
PAYLOAD_MAX_LEN
:
usize
=
4
_194_304
;
#[derive(Debug,
Deserialize)]
#[derive(Debug,
Deserialize)]
#[serde(untagged)]
#[serde(untagged)]
pub
(
super
)
enum
InternalMessage
{
pub
(
super
)
enum
InternalMessage
{
...
@@ -304,17 +302,6 @@ impl Channel {
...
@@ -304,17 +302,6 @@ impl Channel {
})
})
.unwrap
();
.unwrap
();
if
message
.len
()
>
PAYLOAD_MAX_LEN
{
self
.inner
.requests_container_weak
.upgrade
()
.ok_or
(
RequestError
::
ChannelClosed
)
?
.lock
()
.handlers
.remove
(
&
id
);
return
Err
(
RequestError
::
MessageTooLong
);
}
{
{
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
outgoing_message_buffer
.messages
.push_back
(
message
);
outgoing_message_buffer
.messages
.push_back
(
message
);
...
...
rust/src/worker/payload_channel.rs
浏览文件 @
96b2665a
...
@@ -14,8 +14,6 @@ use std::sync::{Arc, Weak};
...
@@ -14,8 +14,6 @@ use std::sync::{Arc, Weak};
use
std
::
time
::
Duration
;
use
std
::
time
::
Duration
;
use
thiserror
::
Error
;
use
thiserror
::
Error
;
const
PAYLOAD_MAX_LEN
:
usize
=
4
_194_304
;
#[derive(Debug)]
#[derive(Debug)]
pub
(
super
)
enum
InternalMessage
{
pub
(
super
)
enum
InternalMessage
{
/// Unknown data
/// Unknown data
...
@@ -59,8 +57,6 @@ fn deserialize_message(bytes: &[u8]) -> PayloadChannelReceiveMessage {
...
@@ -59,8 +57,6 @@ fn deserialize_message(bytes: &[u8]) -> PayloadChannelReceiveMessage {
pub
enum
NotificationError
{
pub
enum
NotificationError
{
#[error(
"Channel already closed"
)]
#[error(
"Channel already closed"
)]
ChannelClosed
,
ChannelClosed
,
#[error(
"Payload is too long"
)]
PayloadTooLong
,
}
}
struct
ResponseError
{
struct
ResponseError
{
...
@@ -224,17 +220,6 @@ impl PayloadChannel {
...
@@ -224,17 +220,6 @@ impl PayloadChannel {
debug!
(
"request() [method:{}, id:{}]: {:?}"
,
method
,
id
,
request
);
debug!
(
"request() [method:{}, id:{}]: {:?}"
,
method
,
id
,
request
);
if
payload
.len
()
>
PAYLOAD_MAX_LEN
{
self
.inner
.requests_container_weak
.upgrade
()
.ok_or
(
RequestError
::
ChannelClosed
)
?
.lock
()
.handlers
.remove
(
&
id
);
return
Err
(
RequestError
::
PayloadTooLong
);
}
{
{
#[derive(Debug,
Serialize)]
#[derive(Debug,
Serialize)]
struct
RequestMessagePrivate
<
'a
,
R
>
{
struct
RequestMessagePrivate
<
'a
,
R
>
{
...
@@ -318,10 +303,6 @@ impl PayloadChannel {
...
@@ -318,10 +303,6 @@ impl PayloadChannel {
{
{
debug!
(
"notify() [event:{}]"
,
notification
.as_event
());
debug!
(
"notify() [event:{}]"
,
notification
.as_event
());
if
payload
.len
()
>
PAYLOAD_MAX_LEN
{
return
Err
(
NotificationError
::
PayloadTooLong
);
}
{
{
#[derive(Debug,
Serialize)]
#[derive(Debug,
Serialize)]
struct
NotificationMessagePrivate
<
'a
,
N
:
Serialize
>
{
struct
NotificationMessagePrivate
<
'a
,
N
:
Serialize
>
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论