Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
8cf4ecd8
提交
8cf4ecd8
authored
9月 09, 2021
作者:
Nazar Mokrynskyi
提交者:
José Luis Millán
3月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused code
上级
ff17d135
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
0 行增加
和
100 行删除
+0
-100
TcpConnectionHandler.hpp
worker/include/handles/TcpConnectionHandler.hpp
+0
-1
UnixStreamSocket.hpp
worker/include/handles/UnixStreamSocket.hpp
+0
-4
TcpConnectionHandler.cpp
worker/src/handles/TcpConnectionHandler.cpp
+0
-95
没有找到文件。
worker/include/handles/TcpConnectionHandler.hpp
浏览文件 @
8cf4ecd8
...
@@ -66,7 +66,6 @@ public:
...
@@ -66,7 +66,6 @@ public:
return
this
->
uvHandle
;
return
this
->
uvHandle
;
}
}
void
Start
();
void
Start
();
void
Write
(
const
uint8_t
*
data
,
size_t
len
,
TcpConnectionHandler
::
onSendCallback
*
cb
);
void
Write
(
void
Write
(
const
uint8_t
*
data1
,
const
uint8_t
*
data1
,
size_t
len1
,
size_t
len1
,
...
...
worker/include/handles/UnixStreamSocket.hpp
浏览文件 @
8cf4ecd8
...
@@ -47,10 +47,6 @@ public:
...
@@ -47,10 +47,6 @@ public:
return
this
->
closed
;
return
this
->
closed
;
}
}
void
Write
(
const
uint8_t
*
data
,
size_t
len
);
void
Write
(
const
uint8_t
*
data
,
size_t
len
);
void
Write
(
const
std
::
string
&
data
)
{
Write
(
reinterpret_cast
<
const
uint8_t
*>
(
data
.
c_str
()),
data
.
size
());
}
/* Callbacks fired by UV events. */
/* Callbacks fired by UV events. */
public
:
public
:
...
...
worker/src/handles/TcpConnectionHandler.cpp
浏览文件 @
8cf4ecd8
...
@@ -174,101 +174,6 @@ void TcpConnectionHandler::Start()
...
@@ -174,101 +174,6 @@ void TcpConnectionHandler::Start()
MS_THROW_ERROR
(
"error setting peer IP and port"
);
MS_THROW_ERROR
(
"error setting peer IP and port"
);
}
}
void
TcpConnectionHandler
::
Write
(
const
uint8_t
*
data
,
size_t
len
,
TcpConnectionHandler
::
onSendCallback
*
cb
)
{
MS_TRACE
();
if
(
this
->
closed
)
{
if
(
cb
)
{
(
*
cb
)(
false
);
delete
cb
;
}
return
;
}
if
(
len
==
0
)
{
if
(
cb
)
{
(
*
cb
)(
false
);
delete
cb
;
}
return
;
}
// First try uv_try_write(). In case it can not directly write all the given
// data then build a uv_req_t and use uv_write().
uv_buf_t
buffer
=
uv_buf_init
(
reinterpret_cast
<
char
*>
(
const_cast
<
uint8_t
*>
(
data
)),
len
);
int
written
=
uv_try_write
(
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
&
buffer
,
1
);
// All the data was written. Done.
if
(
written
==
static_cast
<
int
>
(
len
))
{
// Update sent bytes.
this
->
sentBytes
+=
written
;
if
(
cb
)
{
(
*
cb
)(
true
);
delete
cb
;
}
return
;
}
// Cannot write any data at first time. Use uv_write().
else
if
(
written
==
UV_EAGAIN
||
written
==
UV_ENOSYS
)
{
// Set written to 0 so pendingLen can be properly calculated.
written
=
0
;
}
// Any other error.
else
if
(
written
<
0
)
{
MS_WARN_DEV
(
"uv_try_write() failed, trying uv_write(): %s"
,
uv_strerror
(
written
));
// Set written to 0 so pendingLen can be properly calculated.
written
=
0
;
}
size_t
pendingLen
=
len
-
written
;
auto
*
writeData
=
new
UvWriteData
(
pendingLen
);
writeData
->
req
.
data
=
static_cast
<
void
*>
(
writeData
);
std
::
memcpy
(
writeData
->
store
,
data
+
written
,
pendingLen
);
writeData
->
cb
=
cb
;
buffer
=
uv_buf_init
(
reinterpret_cast
<
char
*>
(
writeData
->
store
),
pendingLen
);
int
err
=
uv_write
(
&
writeData
->
req
,
reinterpret_cast
<
uv_stream_t
*>
(
this
->
uvHandle
),
&
buffer
,
1
,
static_cast
<
uv_write_cb
>
(
onWrite
));
if
(
err
!=
0
)
{
MS_WARN_DEV
(
"uv_write() failed: %s"
,
uv_strerror
(
err
));
if
(
cb
)
(
*
cb
)(
false
);
// Delete the UvWriteData struct (it will delete the store and cb too).
delete
writeData
;
}
else
{
// Update sent bytes.
this
->
sentBytes
+=
pendingLen
;
}
}
void
TcpConnectionHandler
::
Write
(
void
TcpConnectionHandler
::
Write
(
const
uint8_t
*
data1
,
const
uint8_t
*
data1
,
size_t
len1
,
size_t
len1
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论