Unverified 提交 c014484e authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

Enhance debugging on channel request/notification error (#607)

* Enhance debugging on channel request/notification error

* Enhance debugging on channel request/notification error, cont
上级 d87db471
......@@ -253,8 +253,14 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
{
std::string routerId;
// This may throw.
SetNewRouterIdFromInternal(request->internal, routerId);
try
{
SetNewRouterIdFromInternal(request->internal, routerId);
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
auto* router = new RTC::Router(routerId);
......@@ -269,8 +275,16 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
case Channel::ChannelRequest::MethodId::ROUTER_CLOSE:
{
// This may throw.
RTC::Router* router = GetRouterFromInternal(request->internal);
RTC::Router* router{ nullptr };
try
{
router = GetRouterFromInternal(request->internal);
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
// Remove it from the map and delete it.
this->mapRouters.erase(router->id);
......@@ -286,10 +300,20 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
// Any other request must be delivered to the corresponding Router.
default:
{
// This may throw.
RTC::Router* router = GetRouterFromInternal(request->internal);
router->HandleRequest(request);
try
{
RTC::Router* router = GetRouterFromInternal(request->internal);
router->HandleRequest(request);
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
break;
}
......@@ -317,10 +341,20 @@ inline void Worker::OnPayloadChannelNotification(
MS_DEBUG_DEV("PayloadChannel notification received [event:%s]", notification->event.c_str());
// This may throw.
RTC::Router* router = GetRouterFromInternal(notification->internal);
try
{
RTC::Router* router = GetRouterFromInternal(notification->internal);
router->HandleNotification(notification);
router->HandleNotification(notification);
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [event:%s]", error.buffer, notification->event.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, notification->event.c_str());
}
}
inline void Worker::OnPayloadChannelRequest(
......@@ -334,10 +368,20 @@ inline void Worker::OnPayloadChannelRequest(
request->method.c_str(),
request->id);
// This may throw.
RTC::Router* router = GetRouterFromInternal(request->internal);
try
{
RTC::Router* router = GetRouterFromInternal(request->internal);
router->HandleRequest(request);
router->HandleRequest(request);
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
}
}
inline void Worker::OnPayloadChannelClosed(PayloadChannel::PayloadChannelSocket* /*payloadChannel*/)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论