Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
36c72b23
提交
36c72b23
authored
8月 25, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize payload channel performance for writes, allocate send/receive buffers upfront
上级
45bb7d7f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
3 行增加
和
10 行删除
+3
-10
messages.rs
rust/src/messages.rs
+0
-0
channel.rs
rust/src/worker/channel.rs
+3
-10
payload_channel.rs
rust/src/worker/payload_channel.rs
+0
-0
没有找到文件。
rust/src/messages.rs
浏览文件 @
36c72b23
差异被折叠。
点击展开。
rust/src/worker/channel.rs
浏览文件 @
36c72b23
...
@@ -17,7 +17,7 @@ use std::io;
...
@@ -17,7 +17,7 @@ use std::io;
use
std
::
sync
::{
Arc
,
Weak
};
use
std
::
sync
::{
Arc
,
Weak
};
use
std
::
time
::
Duration
;
use
std
::
time
::
Duration
;
const
NS_
PAYLOAD_MAX_LEN
:
usize
=
4
_194_304
;
const
PAYLOAD_MAX_LEN
:
usize
=
4
_194_304
;
#[derive(Debug,
Deserialize)]
#[derive(Debug,
Deserialize)]
#[serde(untagged)]
#[serde(untagged)]
...
@@ -148,7 +148,7 @@ impl Channel {
...
@@ -148,7 +148,7 @@ impl Channel {
executor
executor
.spawn
(
async
move
{
.spawn
(
async
move
{
let
mut
len_bytes
=
[
0u8
;
4
];
let
mut
len_bytes
=
[
0u8
;
4
];
let
mut
bytes
=
Vec
::
new
(
);
let
mut
bytes
=
Vec
::
with_capacity
(
PAYLOAD_MAX_LEN
);
let
mut
reader
=
BufReader
::
new
(
reader
);
let
mut
reader
=
BufReader
::
new
(
reader
);
// This this contain cache of targets that are known to not have buffering, so
// This this contain cache of targets that are known to not have buffering, so
// that we can avoid Mutex locking overhead for them
// that we can avoid Mutex locking overhead for them
...
@@ -159,13 +159,6 @@ impl Channel {
...
@@ -159,13 +159,6 @@ impl Channel {
reader
.read_exact
(
&
mut
len_bytes
)
.await
?
;
reader
.read_exact
(
&
mut
len_bytes
)
.await
?
;
let
length
=
u32
::
from_ne_bytes
(
len_bytes
)
as
usize
;
let
length
=
u32
::
from_ne_bytes
(
len_bytes
)
as
usize
;
if
length
>
NS_PAYLOAD_MAX_LEN
{
warn!
(
"received message {} is too long, max supported is {}"
,
length
,
NS_PAYLOAD_MAX_LEN
,
);
}
if
bytes
.len
()
<
length
{
if
bytes
.len
()
<
length
{
// Increase bytes size if/when needed
// Increase bytes size if/when needed
bytes
.resize
(
length
,
0
);
bytes
.resize
(
length
,
0
);
...
@@ -353,7 +346,7 @@ impl Channel {
...
@@ -353,7 +346,7 @@ impl Channel {
.unwrap
(),
.unwrap
(),
);
);
if
bytes
.len
()
>
NS_
PAYLOAD_MAX_LEN
{
if
bytes
.len
()
>
PAYLOAD_MAX_LEN
{
self
.inner
self
.inner
.requests_container_weak
.requests_container_weak
.upgrade
()
.upgrade
()
...
...
rust/src/worker/payload_channel.rs
浏览文件 @
36c72b23
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论