Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
222ebd2c
Unverified
提交
222ebd2c
authored
7月 28, 2023
作者:
Iñaki Baz Castillo
提交者:
GitHub
7月 28, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid ASAN "new-delete-type-mismatch" harmless but noisy warning (#1129)
上级
dc4f8f30
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
105 行增加
和
45 行删除
+105
-45
ChannelSocket.cpp
worker/src/Channel/ChannelSocket.cpp
+4
-3
DepLibUV.cpp
worker/src/DepLibUV.cpp
+3
-3
PayloadChannelSocket.cpp
worker/src/PayloadChannel/PayloadChannelSocket.cpp
+4
-3
PortManager.cpp
worker/src/RTC/PortManager.cpp
+54
-10
SignalsHandler.cpp
worker/src/handles/SignalsHandler.cpp
+3
-3
TcpConnectionHandler.cpp
worker/src/handles/TcpConnectionHandler.cpp
+11
-4
TcpServerHandler.cpp
worker/src/handles/TcpServerHandler.cpp
+5
-5
Timer.cpp
worker/src/handles/Timer.cpp
+3
-3
UdpSocketHandler.cpp
worker/src/handles/UdpSocketHandler.cpp
+5
-5
UnixStreamSocket.cpp
worker/src/handles/UnixStreamSocket.cpp
+13
-6
没有找到文件。
worker/src/Channel/ChannelSocket.cpp
浏览文件 @
222ebd2c
...
...
@@ -24,9 +24,9 @@ namespace Channel
}
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Async
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_async_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -100,7 +100,8 @@ namespace Channel
if
(
this
->
uvReadHandle
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvReadHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvReadHandle
),
static_cast
<
uv_close_cb
>
(
onCloseAsync
));
}
if
(
this
->
consumerSocket
)
...
...
worker/src/DepLibUV.cpp
浏览文件 @
222ebd2c
...
...
@@ -11,9 +11,9 @@ thread_local uv_loop_t* DepLibUV::loop{ nullptr };
/* Static methods for UV callbacks. */
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Loop
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_loop_t
*>
(
handle
)
;
}
inline
static
void
onWalk
(
uv_handle_t
*
handle
,
void
*
/*arg*/
)
...
...
@@ -27,7 +27,7 @@ inline static void onWalk(uv_handle_t* handle, void* /*arg*/)
uv_has_ref
(
handle
));
if
(
!
uv_is_closing
(
handle
))
uv_close
(
handle
,
onClose
);
uv_close
(
handle
,
onClose
Loop
);
}
/* Static methods. */
...
...
worker/src/PayloadChannel/PayloadChannelSocket.cpp
浏览文件 @
222ebd2c
...
...
@@ -25,9 +25,9 @@ namespace PayloadChannel
}
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Async
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_async_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -102,7 +102,8 @@ namespace PayloadChannel
if
(
this
->
uvReadHandle
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvReadHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvReadHandle
),
static_cast
<
uv_close_cb
>
(
onCloseAsync
));
}
if
(
this
->
consumerSocket
)
...
...
worker/src/RTC/PortManager.cpp
浏览文件 @
222ebd2c
...
...
@@ -12,9 +12,16 @@
/* Static methods for UV callbacks. */
static
inline
void
onClose
(
uv_handle_t
*
handle
)
// NOTE: We have different onCloseXxx() callbacks to avoid an ASAN warning by
// ensuring that we call `delete xxx` with same type as `new xxx` before.
static
inline
void
onCloseUdp
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_udp_t
*>
(
handle
);
}
static
inline
void
onCloseTcp
(
uv_handle_t
*
handle
)
{
delete
reinterpret_cast
<
uv_tcp_t
*>
(
handle
);
}
inline
static
void
onFakeConnection
(
uv_stream_t
*
/*handle*/
,
int
/*status*/
)
...
...
@@ -161,30 +168,44 @@ namespace RTC
switch
(
transport
)
{
case
Transport
:
:
UDP
:
{
uvHandle
=
reinterpret_cast
<
uv_handle_t
*>
(
new
uv_udp_t
());
err
=
uv_udp_init_ex
(
DepLibUV
::
GetLoop
(),
reinterpret_cast
<
uv_udp_t
*>
(
uvHandle
),
UV_UDP_RECVMMSG
);
break
;
}
case
Transport
:
:
TCP
:
{
uvHandle
=
reinterpret_cast
<
uv_handle_t
*>
(
new
uv_tcp_t
());
err
=
uv_tcp_init
(
DepLibUV
::
GetLoop
(),
reinterpret_cast
<
uv_tcp_t
*>
(
uvHandle
));
break
;
}
}
if
(
err
!=
0
)
{
delete
uvHandle
;
switch
(
transport
)
{
case
Transport
:
:
UDP
:
{
delete
reinterpret_cast
<
uv_udp_t
*>
(
uvHandle
);
MS_THROW_ERROR
(
"uv_udp_init_ex() failed: %s"
,
uv_strerror
(
err
));
break
;
}
case
Transport
:
:
TCP
:
{
delete
reinterpret_cast
<
uv_tcp_t
*>
(
uvHandle
);
MS_THROW_ERROR
(
"uv_tcp_init() failed: %s"
,
uv_strerror
(
err
));
break
;
}
}
}
...
...
@@ -259,7 +280,22 @@ namespace RTC
break
;
// If it failed, close the handle and check the reason.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
switch
(
transport
)
{
case
Transport
:
:
UDP
:
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onCloseUdp
));
break
;
};
case
Transport
:
:
TCP
:
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onCloseTcp
));
break
;
}
}
switch
(
err
)
{
...
...
@@ -400,17 +436,25 @@ namespace RTC
if
(
err
!=
0
)
{
delete
uvHandle
;
switch
(
transport
)
{
case
Transport
:
:
UDP
:
{
delete
reinterpret_cast
<
uv_udp_t
*>
(
uvHandle
);
MS_THROW_ERROR
(
"uv_udp_init_ex() failed: %s"
,
uv_strerror
(
err
));
break
;
}
case
Transport
:
:
TCP
:
{
delete
reinterpret_cast
<
uv_tcp_t
*>
(
uvHandle
);
MS_THROW_ERROR
(
"uv_tcp_init() failed: %s"
,
uv_strerror
(
err
));
break
;
}
}
}
...
...
@@ -426,7 +470,7 @@ namespace RTC
if
(
err
!=
0
)
{
// If it failed, close the handle and check the reason.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Udp
));
MS_THROW_ERROR
(
"uv_udp_bind() failed [transport:%s, ip:'%s', port:%"
PRIu16
"]: %s"
,
...
...
@@ -449,7 +493,7 @@ namespace RTC
if
(
err
!=
0
)
{
// If it failed, close the handle and check the reason.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
MS_THROW_ERROR
(
"uv_tcp_bind() failed [transport:%s, ip:'%s', port:%"
PRIu16
"]: %s"
,
...
...
@@ -469,7 +513,7 @@ namespace RTC
if
(
err
!=
0
)
{
// If it failed, close the handle and check the reason.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
MS_THROW_ERROR
(
"uv_listen() failed [transport:%s, ip:'%s', port:%"
PRIu16
"]: %s"
,
...
...
worker/src/handles/SignalsHandler.cpp
浏览文件 @
222ebd2c
...
...
@@ -13,9 +13,9 @@ inline static void onSignal(uv_signal_t* handle, int signum)
static_cast
<
SignalsHandler
*>
(
handle
->
data
)
->
OnUvSignal
(
signum
);
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Signal
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_signal_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -44,7 +44,7 @@ void SignalsHandler::Close()
for
(
auto
*
uvHandle
:
this
->
uvHandles
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Signal
));
}
}
...
...
worker/src/handles/TcpConnectionHandler.cpp
浏览文件 @
222ebd2c
...
...
@@ -40,9 +40,16 @@ inline static void onWrite(uv_write_t* req, int status)
delete
writeData
;
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
// NOTE: We have different onCloseXxx() callbacks to avoid an ASAN warning by
// ensuring that we call `delete xxx` with same type as `new xxx` before.
inline
static
void
onCloseTcp
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_tcp_t
*>
(
handle
);
}
inline
static
void
onCloseShutdown
(
uv_handle_t
*
handle
)
{
delete
reinterpret_cast
<
uv_shutdown_t
*>
(
handle
);
}
inline
static
void
onShutdown
(
uv_shutdown_t
*
req
,
int
/*status*/
)
...
...
@@ -52,7 +59,7 @@ inline static void onShutdown(uv_shutdown_t* req, int /*status*/)
delete
req
;
// Now do close the handle.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
handle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
handle
),
static_cast
<
uv_close_cb
>
(
onClose
Shutdown
));
}
/* Instance methods. */
...
...
@@ -114,7 +121,7 @@ void TcpConnectionHandler::Close()
// Otherwise directly close the socket.
else
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
}
}
...
...
worker/src/handles/TcpServerHandler.cpp
浏览文件 @
222ebd2c
...
...
@@ -20,9 +20,9 @@ inline static void onConnection(uv_stream_t* handle, int status)
server
->
OnUvConnection
(
status
);
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Tcp
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_tcp_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -43,7 +43,7 @@ TcpServerHandler::TcpServerHandler(uv_tcp_t* uvHandle) : uvHandle(uvHandle)
if
(
err
!=
0
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
MS_THROW_ERROR
(
"uv_listen() failed: %s"
,
uv_strerror
(
err
));
}
...
...
@@ -51,7 +51,7 @@ TcpServerHandler::TcpServerHandler(uv_tcp_t* uvHandle) : uvHandle(uvHandle)
// Set local address.
if
(
!
SetLocalAddress
())
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
MS_THROW_ERROR
(
"error setting local IP and port"
);
}
...
...
@@ -84,7 +84,7 @@ void TcpServerHandler::Close()
delete
connection
;
}
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Tcp
));
}
void
TcpServerHandler
::
Dump
()
const
...
...
worker/src/handles/Timer.cpp
浏览文件 @
222ebd2c
...
...
@@ -13,9 +13,9 @@ inline static void onTimer(uv_timer_t* handle)
static_cast
<
Timer
*>
(
handle
->
data
)
->
OnUvTimer
();
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Timer
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_timer_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -59,7 +59,7 @@ void Timer::Close()
this
->
closed
=
true
;
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Timer
));
}
void
Timer
::
Start
(
uint64_t
timeout
,
uint64_t
repeat
)
...
...
worker/src/handles/UdpSocketHandler.cpp
浏览文件 @
222ebd2c
...
...
@@ -45,9 +45,9 @@ inline static void onSend(uv_udp_send_t* req, int status)
delete
sendData
;
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
inline
static
void
onClose
Udp
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_udp_t
*>
(
handle
)
;
}
/* Instance methods. */
...
...
@@ -66,7 +66,7 @@ UdpSocketHandler::UdpSocketHandler(uv_udp_t* uvHandle) : uvHandle(uvHandle)
if
(
err
!=
0
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Udp
));
MS_THROW_ERROR
(
"uv_udp_recv_start() failed: %s"
,
uv_strerror
(
err
));
}
...
...
@@ -74,7 +74,7 @@ UdpSocketHandler::UdpSocketHandler(uv_udp_t* uvHandle) : uvHandle(uvHandle)
// Set local address.
if
(
!
SetLocalAddress
())
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Udp
));
MS_THROW_ERROR
(
"error setting local IP and port"
);
}
...
...
@@ -106,7 +106,7 @@ void UdpSocketHandler::Close()
if
(
err
!=
0
)
MS_ABORT
(
"uv_udp_recv_stop() failed: %s"
,
uv_strerror
(
err
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Udp
));
}
void
UdpSocketHandler
::
Dump
()
const
...
...
worker/src/handles/UnixStreamSocket.cpp
浏览文件 @
222ebd2c
...
...
@@ -44,9 +44,16 @@ inline static void onWrite(uv_write_t* req, int status)
delete
writeData
;
}
inline
static
void
onClose
(
uv_handle_t
*
handle
)
// NOTE: We have different onCloseXxx() callbacks to avoid an ASAN warning by
// ensuring that we call `delete xxx` with same type as `new xxx` before.
inline
static
void
onClosePipe
(
uv_handle_t
*
handle
)
{
delete
handle
;
delete
reinterpret_cast
<
uv_pipe_t
*>
(
handle
);
}
inline
static
void
onCloseShutdown
(
uv_handle_t
*
handle
)
{
delete
reinterpret_cast
<
uv_shutdown_t
*>
(
handle
);
}
inline
static
void
onShutdown
(
uv_shutdown_t
*
req
,
int
/*status*/
)
...
...
@@ -56,7 +63,7 @@ inline static void onShutdown(uv_shutdown_t* req, int /*status*/)
delete
req
;
// Now do close the handle.
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
handle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
handle
),
static_cast
<
uv_close_cb
>
(
onClose
Shutdown
));
}
/* Instance methods. */
...
...
@@ -85,7 +92,7 @@ UnixStreamSocket::UnixStreamSocket(int fd, size_t bufferSize, UnixStreamSocket::
if
(
err
!=
0
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Pipe
));
MS_THROW_ERROR_STD
(
"uv_pipe_open() failed: %s"
,
uv_strerror
(
err
));
}
...
...
@@ -100,7 +107,7 @@ UnixStreamSocket::UnixStreamSocket(int fd, size_t bufferSize, UnixStreamSocket::
if
(
err
!=
0
)
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Pipe
));
MS_THROW_ERROR_STD
(
"uv_read_start() failed: %s"
,
uv_strerror
(
err
));
}
...
...
@@ -157,7 +164,7 @@ void UnixStreamSocket::Close()
// Otherwise directly close the socket.
else
{
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
));
uv_close
(
reinterpret_cast
<
uv_handle_t
*>
(
this
->
uvHandle
),
static_cast
<
uv_close_cb
>
(
onClose
Pipe
));
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论