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