Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-08-31 23:34:03 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
11c409688b8d1876b313e74843dfbd1d86cfc8ba
11c40968
1 parent
8a2709dd
for #319, http raw api support query. 3.0.3
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
77 行增加
和
16 行删除
README.md
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_http_api.cpp
trunk/src/core/srs_core.hpp
README.md
查看文件 @
11c4096
...
...
@@ -342,6 +342,7 @@ Remark:
## History
*
v3.0, 2015-08-31, fix
[
#319
][
bug #319
]
, http raw api support query global and vhost. 3.0.3
*
v3.0, 2015-08-28, fix
[
#471
][
bug #471
]
, api response the width and height. 3.0.2
*
v3.0, 2015-08-25, fix
[
#367
][
bug #367
]
, support nginx-rtmp exec. 3.0.1
*
<strong>
v2.0, 2015-08-23,
[
2.0 alpha(2.0.185)
][
r2.0a0
]
released. 89022 lines.
</strong>
...
...
@@ -1184,6 +1185,7 @@ Winlin
[
bug #50
]:
https://github.com/simple-rtmp-server/srs/issues/50
[
bug #34
]:
https://github.com/simple-rtmp-server/srs/issues/34
[
bug #367
]:
https://github.com/simple-rtmp-server/srs/issues/367
[
bug #319
]:
https://github.com/simple-rtmp-server/srs/issues/319
[
r2.0a0
]:
https://github.com/simple-rtmp-server/srs/releases/tag/2.0a0
[
r1.0r4
]:
https://github.com/simple-rtmp-server/srs/releases/tag/1.0r4
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
11c4096
...
...
@@ -944,15 +944,10 @@ int SrsConfig::reload_conf(SrsConfig* conf)
// merge config: pid
if
(
!
srs_directive_equals
(
root
->
get
(
"pid"
),
old_root
->
get
(
"pid"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_pid
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"notify subscribes reload pid failed. ret=%d"
,
ret
);
if
((
ret
=
do_reload_pid
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
}
srs_trace
(
"reload pid success."
);
}
// merge config: srs_log_tank
if
(
!
srs_directive_equals
(
root
->
get
(
"srs_log_tank"
),
old_root
->
get
(
"srs_log_tank"
)))
{
...
...
@@ -2213,21 +2208,47 @@ int SrsConfig::raw_set_listen(const vector<string>& eps, bool& applied)
applied
=
false
;
SrsConfDirective
*
listen
=
root
->
get
(
"listen"
);
SrsConfDirective
*
conf
=
root
->
get
(
"listen"
);
// not changed, ignore.
if
(
srs_vector_actual_equals
(
listen
->
args
,
eps
))
{
if
(
srs_vector_actual_equals
(
conf
->
args
,
eps
))
{
return
ret
;
}
// changed, apply and reload.
listen
->
args
=
eps
;
conf
->
args
=
eps
;
if
((
ret
=
do_reload_listen
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
applied
=
true
;
return
ret
;
}
int
SrsConfig
::
raw_set_pid
(
string
pid
,
bool
&
applied
)
{
int
ret
=
ERROR_SUCCESS
;
applied
=
false
;
SrsConfDirective
*
conf
=
root
->
get_or_create
(
"pid"
);
if
(
conf
->
arg0
()
==
pid
)
{
return
ret
;
}
conf
->
args
.
clear
();
conf
->
args
.
push_back
(
pid
);
if
((
ret
=
do_reload_pid
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
applied
=
true
;
return
ret
;
}
...
...
@@ -2235,7 +2256,6 @@ int SrsConfig::do_reload_listen()
{
int
ret
=
ERROR_SUCCESS
;
// force to reload the memory server.
vector
<
ISrsReloadHandler
*>::
iterator
it
;
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
...
...
@@ -2249,6 +2269,23 @@ int SrsConfig::do_reload_listen()
return
ret
;
}
int
SrsConfig
::
do_reload_pid
()
{
int
ret
=
ERROR_SUCCESS
;
vector
<
ISrsReloadHandler
*>::
iterator
it
;
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_pid
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"notify subscribes reload pid failed. ret=%d"
,
ret
);
return
ret
;
}
}
srs_trace
(
"reload pid success."
);
return
ret
;
}
string
SrsConfig
::
config
()
{
return
config_file
;
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
11c4096
...
...
@@ -331,14 +331,15 @@ public:
virtual
int
raw_to_json
(
SrsAmf0Object
*
obj
);
/**
* raw set the global listen.
* @param applied whether the config is applied.
*/
virtual
int
raw_set_listen
(
const
std
::
vector
<
std
::
string
>&
eps
,
bool
&
applied
);
private
:
/**
*
do reload listen, for reload from signal or raw api
.
*
raw set the global pid
.
*/
virtual
int
raw_set_pid
(
std
::
string
pid
,
bool
&
applied
);
private
:
virtual
int
do_reload_listen
();
virtual
int
do_reload_pid
();
public
:
/**
* get the config file path.
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
11c4096
...
...
@@ -977,6 +977,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
// possible updates:
// @param scope @param value value-description
// global.listen 1935,1936 the port list.
// global.pid ./objs/srs.pid the pid file of srs.
if
(
rpc
==
"update"
)
{
if
(
!
allow_update
)
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_DISABLED
;
...
...
@@ -986,7 +987,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
std
::
string
scope
=
r
->
query_get
(
"scope"
);
std
::
string
value
=
r
->
query_get
(
"value"
);
if
(
scope
.
empty
()
||
(
scope
!=
"global.listen"
))
{
if
(
scope
.
empty
()
||
(
scope
!=
"global.listen"
&&
scope
!=
"global.pid"
))
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api query invalid scope=%s. ret=%d"
,
scope
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
...
...
@@ -1007,7 +1008,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
}
if
(
invalid
)
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api update global.listen=%s failed. ret=%d"
,
value
.
c_str
(),
ret
);
srs_error
(
"raw api update
check
global.listen=%s failed. ret=%d"
,
value
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
...
...
@@ -1015,6 +1016,26 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
srs_error
(
"raw api update global.listen=%s failed. ret=%d"
,
value
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
}
else
if
(
scope
==
"global.pid"
)
{
bool
invalid
=
value
.
empty
();
if
(
!
invalid
)
{
invalid
=
!
srs_string_starts_with
(
value
,
"./"
)
&&
!
srs_string_starts_with
(
value
,
"/tmp"
)
&&
!
srs_string_starts_with
(
value
,
"/var"
);
}
if
(
!
invalid
)
{
invalid
=
!
srs_string_ends_with
(
value
,
".pid"
);
}
if
(
invalid
)
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api update check global.pid=%s failed. ret=%d"
,
value
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
if
((
ret
=
_srs_config
->
raw_set_pid
(
value
,
applied
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"raw api update global.pid=%s failed. ret=%d"
,
value
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
}
// whether the config applied.
...
...
trunk/src/core/srs_core.hpp
查看文件 @
11c4096
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION
2
#define VERSION_REVISION
3
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
请
注册
或
登录
后发表评论