From 8125dd4dd1f639d76a282c566556efb271a994e8 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 30 Oct 2021 07:59:57 +0800 Subject: [PATCH] Forward: Fast quit when cycle fail. v4.0.188 (#2284) --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_forward.cpp | 6 ++++++ trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index a568386eb..e4f3f0ff8 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-10-30, Merge [#2284](https://github.com/ossrs/srs/pull/2284): Forward: Fast quit when cycle fail. v4.0.188 * v4.0, 2021-10-28, Merge [#2186](https://github.com/ossrs/srs/pull/2186): Gop: Ignore zero timestamp when shrinking. v4.0.187 * v4.0, 2021-10-27, Merge [#1963](https://github.com/ossrs/srs/pull/1963): Cluster: Origin server shouldn't be it's own coworker. v4.0.186 * v4.0, 2021-10-25, Merge [#2692](https://github.com/ossrs/srs/pull/2692): API: Add server_id into http_hooks. v4.0.185 diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index 0bad6bce5..06cfd118c 100755 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -175,6 +175,12 @@ srs_error_t SrsForwarder::cycle() srs_freep(err); } + // Never wait if thread error, fast quit. + // @see https://github.com/ossrs/srs/pull/2284 + if ((err = trd->pull()) != srs_success) { + return srs_error_wrap(err, "forwarder"); + } + srs_usleep(SRS_FORWARDER_CIMS); } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9b733cf82..4a9b70d90 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 187 +#define VERSION_REVISION 188 #endif