Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
2a7e950d
提交
2a7e950d
authored
12月 21, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve MS_TRACE
上级
cbd4017d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
16 行删除
+15
-16
Logger.h
worker/include/Logger.h
+1
-1
Request.cpp
worker/src/Channel/Request.cpp
+14
-15
没有找到文件。
worker/include/Logger.h
浏览文件 @
2a7e950d
...
@@ -80,7 +80,7 @@ bool Logger::HasDebugLevel()
...
@@ -80,7 +80,7 @@ bool Logger::HasDebugLevel()
#define MS_TRACE() \
#define MS_TRACE() \
do \
do \
{ \
{ \
dprintf(Logger::fd, "D" _MS_LOG_STR _MS_LOG_SEPARATOR_CHAR, _MS_LOG_ARG); \
dprintf(Logger::fd, "D
(trace)
" _MS_LOG_STR _MS_LOG_SEPARATOR_CHAR, _MS_LOG_ARG); \
} \
} \
while (0)
while (0)
#else
#else
...
...
worker/src/Channel/Request.cpp
浏览文件 @
2a7e950d
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
namespace
Channel
namespace
Channel
{
{
static
Json
::
Value
empty_data
(
Json
::
objectValue
);
/* Static methods. */
/* Static methods. */
Channel
::
Request
*
Request
::
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
)
Channel
::
Request
*
Request
::
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
)
...
@@ -73,21 +75,14 @@ namespace Channel
...
@@ -73,21 +75,14 @@ namespace Channel
{
{
MS_TRACE
();
MS_TRACE
();
static
Json
::
Value
no_data
(
Json
::
nullValue
);
Accept
(
empty_data
);
Accept
(
no_data
);
}
}
void
Request
::
Accept
(
Json
::
Value
&
data
)
void
Request
::
Accept
(
Json
::
Value
&
data
)
{
{
MS_TRACE
();
MS_TRACE
();
if
(
this
->
replied
)
MS_ASSERT
(
!
this
->
replied
,
"Request already replied"
);
{
MS_ERROR
(
"already replied"
);
return
;
}
this
->
replied
=
true
;
this
->
replied
=
true
;
Json
::
Value
json
;
Json
::
Value
json
;
...
@@ -97,6 +92,8 @@ namespace Channel
...
@@ -97,6 +92,8 @@ namespace Channel
if
(
data
.
isObject
())
if
(
data
.
isObject
())
json
[
"data"
]
=
data
;
json
[
"data"
]
=
data
;
else
json
[
"data"
]
=
empty_data
;
this
->
channel
->
Send
(
json
);
this
->
channel
->
Send
(
json
);
}
}
...
@@ -108,18 +105,20 @@ namespace Channel
...
@@ -108,18 +105,20 @@ namespace Channel
Reject
(
status
,
reason
.
c_str
());
Reject
(
status
,
reason
.
c_str
());
}
}
/**
* Reject the Request.
* @param status 4XX means normal rejection, 5XX means error.
* @param reason Description string.
*/
void
Request
::
Reject
(
unsigned
int
status
,
const
char
*
reason
)
void
Request
::
Reject
(
unsigned
int
status
,
const
char
*
reason
)
{
{
MS_TRACE
();
MS_TRACE
();
if
(
this
->
replied
)
MS_ASSERT
(
!
this
->
replied
,
"Request already replied"
);
{
MS_ERROR
(
"already replied"
);
return
;
}
this
->
replied
=
true
;
this
->
replied
=
true
;
MS_ASSERT
(
status
>=
400
&&
status
<=
599
,
"status must be between 400 and 500"
);
Json
::
Value
json
;
Json
::
Value
json
;
json
[
"id"
]
=
this
->
id
;
json
[
"id"
]
=
this
->
id
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论