From 7811b4f3f797059b3b0bc684c279777aedc706ba Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 1 Oct 2015 13:20:13 +0800 Subject: [PATCH] fix #497, response error when client not found to kickoff. 2.0.194 --- README.md | 2 ++ trunk/src/app/srs_app_http_api.cpp | 12 ++++++++---- trunk/src/core/srs_core.hpp | 2 +- trunk/src/kernel/srs_kernel_error.hpp | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c6810f853..09819903a 100755 --- a/README.md +++ b/README.md @@ -335,6 +335,7 @@ Remark: ## History +* v2.0, 2015-10-01, for [#497][bug #497] response error when client not found to kickoff. 2.0.194 * v2.0, 2015-10-01, for [#495][bug #495] decrease the srs-librtmp size. 2.0.193 * v2.0, 2015-09-23, for [#485][bug #485] error when arm glibc 2.15+ or not i386/x86_64/amd64. 2.0.192 * v2.0, 2015-09-23, for [#485][bug #485] srs for respberrypi and cubieboard. 2.0.191 @@ -1029,6 +1030,7 @@ Winlin [bug #484]: https://github.com/simple-rtmp-server/srs/issues/484 [bug #485]: https://github.com/simple-rtmp-server/srs/issues/485 [bug #495]: https://github.com/simple-rtmp-server/srs/issues/495 +[bug #497]: https://github.com/simple-rtmp-server/srs/issues/497 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454 diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index 218403dee..632c1629a 100755 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -794,16 +794,20 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) SrsStatisticClient* client = NULL; if (cid >= 0 && (client = stat->find_client(cid)) == NULL) { - ret = ERROR_RTMP_STREAM_NOT_FOUND; - srs_error("stream client_id=%d not found. ret=%d", cid, ret); + ret = ERROR_RTMP_CLIENT_NOT_FOUND; + srs_error("client id=%d not found. ret=%d", cid, ret); return srs_api_response_code(w, r, ret); } if (r->is_http_delete()) { - srs_assert(client); + if (!client) { + ret = ERROR_RTMP_CLIENT_NOT_FOUND; + srs_error("client id=%d not found. ret=%d", cid, ret); + return srs_api_response_code(w, r, ret); + } client->conn->expire(); - srs_warn("delete client=%d ok", cid); + srs_warn("kickoff client id=%d ok", cid); return srs_api_response_code(w, r, ret); } else if (r->is_http_get()) { std::stringstream data; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index b3ac9b820..a9d367b65 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 193 +#define VERSION_REVISION 194 // server info. #define RTMP_SIG_SRS_KEY "SRS" diff --git a/trunk/src/kernel/srs_kernel_error.hpp b/trunk/src/kernel/srs_kernel_error.hpp index bb7fddcef..83858f901 100755 --- a/trunk/src/kernel/srs_kernel_error.hpp +++ b/trunk/src/kernel/srs_kernel_error.hpp @@ -150,6 +150,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define ERROR_RTP_TYPE97_CORRUPT 2046 #define ERROR_RTSP_AUDIO_CONFIG 2047 #define ERROR_RTMP_STREAM_NOT_FOUND 2048 +#define ERROR_RTMP_CLIENT_NOT_FOUND 2049 // // system control message, // not an error, but special control logic.