winlin

fix #497, response error when client not found to kickoff. 2.0.194

@@ -335,6 +335,7 @@ Remark: @@ -335,6 +335,7 @@ Remark:
335 335
336 ## History 336 ## History
337 337
  338 +* v2.0, 2015-10-01, for [#497][bug #497] response error when client not found to kickoff. 2.0.194
338 * v2.0, 2015-10-01, for [#495][bug #495] decrease the srs-librtmp size. 2.0.193 339 * v2.0, 2015-10-01, for [#495][bug #495] decrease the srs-librtmp size. 2.0.193
339 * v2.0, 2015-09-23, for [#485][bug #485] error when arm glibc 2.15+ or not i386/x86_64/amd64. 2.0.192 340 * v2.0, 2015-09-23, for [#485][bug #485] error when arm glibc 2.15+ or not i386/x86_64/amd64. 2.0.192
340 * v2.0, 2015-09-23, for [#485][bug #485] srs for respberrypi and cubieboard. 2.0.191 341 * v2.0, 2015-09-23, for [#485][bug #485] srs for respberrypi and cubieboard. 2.0.191
@@ -1029,6 +1030,7 @@ Winlin @@ -1029,6 +1030,7 @@ Winlin
1029 [bug #484]: https://github.com/simple-rtmp-server/srs/issues/484 1030 [bug #484]: https://github.com/simple-rtmp-server/srs/issues/484
1030 [bug #485]: https://github.com/simple-rtmp-server/srs/issues/485 1031 [bug #485]: https://github.com/simple-rtmp-server/srs/issues/485
1031 [bug #495]: https://github.com/simple-rtmp-server/srs/issues/495 1032 [bug #495]: https://github.com/simple-rtmp-server/srs/issues/495
  1033 +[bug #497]: https://github.com/simple-rtmp-server/srs/issues/497
1032 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475 1034 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475
1033 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458 1035 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458
1034 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454 1036 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454
@@ -794,16 +794,20 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) @@ -794,16 +794,20 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
794 794
795 SrsStatisticClient* client = NULL; 795 SrsStatisticClient* client = NULL;
796 if (cid >= 0 && (client = stat->find_client(cid)) == NULL) { 796 if (cid >= 0 && (client = stat->find_client(cid)) == NULL) {
797 - ret = ERROR_RTMP_STREAM_NOT_FOUND;  
798 - srs_error("stream client_id=%d not found. ret=%d", cid, ret); 797 + ret = ERROR_RTMP_CLIENT_NOT_FOUND;
  798 + srs_error("client id=%d not found. ret=%d", cid, ret);
799 return srs_api_response_code(w, r, ret); 799 return srs_api_response_code(w, r, ret);
800 } 800 }
801 801
802 if (r->is_http_delete()) { 802 if (r->is_http_delete()) {
803 - srs_assert(client); 803 + if (!client) {
  804 + ret = ERROR_RTMP_CLIENT_NOT_FOUND;
  805 + srs_error("client id=%d not found. ret=%d", cid, ret);
  806 + return srs_api_response_code(w, r, ret);
  807 + }
804 808
805 client->conn->expire(); 809 client->conn->expire();
806 - srs_warn("delete client=%d ok", cid); 810 + srs_warn("kickoff client id=%d ok", cid);
807 return srs_api_response_code(w, r, ret); 811 return srs_api_response_code(w, r, ret);
808 } else if (r->is_http_get()) { 812 } else if (r->is_http_get()) {
809 std::stringstream data; 813 std::stringstream data;
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 193 34 +#define VERSION_REVISION 194
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -150,6 +150,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -150,6 +150,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
150 #define ERROR_RTP_TYPE97_CORRUPT 2046 150 #define ERROR_RTP_TYPE97_CORRUPT 2046
151 #define ERROR_RTSP_AUDIO_CONFIG 2047 151 #define ERROR_RTSP_AUDIO_CONFIG 2047
152 #define ERROR_RTMP_STREAM_NOT_FOUND 2048 152 #define ERROR_RTMP_STREAM_NOT_FOUND 2048
  153 +#define ERROR_RTMP_CLIENT_NOT_FOUND 2049
153 // 154 //
154 // system control message, 155 // system control message,
155 // not an error, but special control logic. 156 // not an error, but special control logic.