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
2014-04-12 20:46:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f652c28485a11dd0cf5439272e1ddeac7095ca9f
f652c284
1 parent
0a016e58
support reload pid.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
41 行增加
和
0 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_reload.cpp
trunk/src/app/srs_app_reload.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/app/srs_app_config.cpp
查看文件 @
f652c28
...
...
@@ -505,6 +505,21 @@ int SrsConfig::reload()
srs_trace
(
"reload listen success."
);
}
// 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
);
return
ret
;
}
}
srs_trace
(
"reload pid success."
);
}
// directly supported for reload:
// chunk_size, ff_log_dir
// merge config: pithy_print
if
(
!
srs_directive_equals
(
root
->
get
(
"pithy_print"
),
old_root
->
get
(
"pithy_print"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
...
...
trunk/src/app/srs_app_reload.cpp
查看文件 @
f652c28
...
...
@@ -40,6 +40,11 @@ int ISrsReloadHandler::on_reload_listen()
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_pid
()
{
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_pithy_print
()
{
return
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_reload.hpp
查看文件 @
f652c28
...
...
@@ -42,6 +42,7 @@ public:
virtual
~
ISrsReloadHandler
();
public
:
virtual
int
on_reload_listen
();
virtual
int
on_reload_pid
();
virtual
int
on_reload_pithy_print
();
virtual
int
on_reload_vhost_added
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_removed
(
std
::
string
vhost
);
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
f652c28
...
...
@@ -159,6 +159,7 @@ SrsServer::SrsServer()
{
signal_reload
=
false
;
signal_gmc_stop
=
false
;
pid_fd
=
-
1
;
// donot new object in constructor,
// for some global instance is not ready now,
...
...
@@ -189,6 +190,11 @@ SrsServer::~SrsServer()
close_listeners
();
if
(
pid_fd
>
0
)
{
::
close
(
pid_fd
);
pid_fd
=
-
1
;
}
#ifdef SRS_HTTP_API
srs_freep
(
http_api_handler
);
#endif
...
...
@@ -310,6 +316,7 @@ int SrsServer::acquire_pid_file()
}
srs_trace
(
"write pid=%d to %s success!"
,
pid
,
pid_file
.
c_str
());
pid_fd
=
fd
;
return
ret
;
}
...
...
@@ -554,3 +561,13 @@ int SrsServer::on_reload_listen()
{
return
listen
();
}
int
SrsServer
::
on_reload_pid
()
{
if
(
pid_fd
>
0
)
{
::
close
(
pid_fd
);
pid_fd
=
-
1
;
}
return
acquire_pid_file
();
}
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
f652c28
...
...
@@ -88,6 +88,7 @@ private:
SrsIngester
*
ingester
;
#endif
private
:
int
pid_fd
;
std
::
vector
<
SrsConnection
*>
conns
;
std
::
vector
<
SrsListener
*>
listeners
;
bool
signal_reload
;
...
...
@@ -107,8 +108,10 @@ public:
private
:
virtual
void
close_listeners
();
virtual
int
accept_client
(
SrsListenerType
type
,
st_netfd_t
client_stfd
);
// interface ISrsThreadHandler.
public:
virtual
int
on_reload_listen
();
virtual
int
on_reload_pid
();
};
#endif
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论