1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge branch '3.0release' into 4.0release

This commit is contained in:
winlin 2020-02-18 22:15:29 +08:00
commit 0c48c42f36
6 changed files with 33 additions and 4 deletions

View file

@ -3488,7 +3488,7 @@ srs_error_t SrsConfig::check_normal_config()
&& n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print_ms"
&& n != "http_server" && n != "stream_caster" && n != "srt_server"
&& n != "utc_time" && n != "work_dir" && n != "asprocess"
&& n != "ff_log_level" && n != "grace_final_wait"
&& n != "ff_log_level" && n != "grace_final_wait" && n != "force_grace_quit"
) {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str());
}
@ -4076,6 +4076,18 @@ srs_utime_t SrsConfig::get_grace_final_wait()
return (srs_utime_t)(::atol(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS);
}
bool SrsConfig::is_force_grace_quit()
{
static bool DEFAULT = false;
SrsConfDirective* conf = root->get("force_grace_quit");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
vector<SrsConfDirective*> SrsConfig::get_stream_casters()
{
srs_assert(root);

View file

@ -470,6 +470,8 @@ public:
virtual bool get_asprocess();
// Get the final wait in ms for gracefully quit.
virtual srs_utime_t get_grace_final_wait();
// Whether force to gracefully quit, never fast quit.
virtual bool is_force_grace_quit();
// stream_caster section
public:
// Get all stream_caster in config file.

View file

@ -915,7 +915,14 @@ void SrsServer::on_signal(int signo)
#endif
#endif
}
// For K8S, force to gracefully quit for gray release or canary.
// @see https://github.com/ossrs/srs/issues/1595#issuecomment-587473037
if (signo == SRS_SIGNAL_FAST_QUIT && _srs_config->is_force_grace_quit()) {
srs_trace("force gracefully quit, signo=%d", signo);
signo = SRS_SIGNAL_GRACEFULLY_QUIT;
}
if ((signo == SIGINT || signo == SRS_SIGNAL_FAST_QUIT) && !signal_fast_quit) {
srs_trace("sig=%d, user terminate program, fast quit", signo);
signal_fast_quit = true;

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 119
#define SRS_VERSION3_REVISION 120
#endif