Unverified 提交 f267a5f4 authored 作者: Juan Navarro's avatar Juan Navarro 提交者: GitHub

Fix bad printing of error messages from Worker (#750)

Directly passing the error buffer caused issues with the snprintf that
MS_THROW_ERROR() does.

Possibly due to the fact that it might be overwriting the same memory
buffer that is passed. This meant that incomplete messages would end up
arriving to the client side.
上级 812d74c1
......@@ -259,7 +259,7 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
auto* router = new RTC::Router(routerId);
......@@ -283,7 +283,7 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
// Remove it from the map and delete it.
......@@ -308,11 +308,11 @@ inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channe
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_TYPE_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
break;
......@@ -349,11 +349,11 @@ inline void Worker::OnPayloadChannelNotification(
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [event:%s]", error.buffer, notification->event.c_str());
MS_THROW_TYPE_ERROR("%s [event:%s]", error.what(), notification->event.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, notification->event.c_str());
MS_THROW_ERROR("%s [method:%s]", error.what(), notification->event.c_str());
}
}
......@@ -376,11 +376,11 @@ inline void Worker::OnPayloadChannelRequest(
}
catch (const MediaSoupTypeError& error)
{
MS_THROW_TYPE_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_TYPE_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
catch (const MediaSoupError& error)
{
MS_THROW_ERROR("%s [method:%s]", error.buffer, request->method.c_str());
MS_THROW_ERROR("%s [method:%s]", error.what(), request->method.c_str());
}
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论