|
|
@ -660,22 +660,8 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|
|
|
srs_error("stream stream_id=%d not found. ret=%d", sid, ret);
|
|
|
|
srs_error("stream stream_id=%d not found. ret=%d", sid, ret);
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (r->is_http_delete()) {
|
|
|
|
if (r->is_http_get()) {
|
|
|
|
srs_assert(stream);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SrsSource* source = SrsSource::fetch(stream->vhost->vhost, stream->app, stream->stream);
|
|
|
|
|
|
|
|
if (!source) {
|
|
|
|
|
|
|
|
ret = ERROR_SOURCE_NOT_FOUND;
|
|
|
|
|
|
|
|
srs_warn("source not found for sid=%d", sid);
|
|
|
|
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
source->set_expired();
|
|
|
|
|
|
|
|
srs_warn("disconnent stream=%d successfully. vhost=%s, app=%s, stream=%s.",
|
|
|
|
|
|
|
|
sid, stream->vhost->vhost.c_str(), stream->app.c_str(), stream->stream.c_str());
|
|
|
|
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
|
|
|
|
} else if (r->is_http_get()) {
|
|
|
|
|
|
|
|
std::stringstream data;
|
|
|
|
std::stringstream data;
|
|
|
|
|
|
|
|
|
|
|
|
if (!stream) {
|
|
|
|
if (!stream) {
|
|
|
@ -726,10 +712,15 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|
|
|
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
|
|
|
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
|
|
|
srs_error("stream client_id=%d not found. ret=%d", cid, ret);
|
|
|
|
srs_error("stream client_id=%d not found. ret=%d", cid, ret);
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (r->is_http_get()) {
|
|
|
|
if (r->is_http_delete()) {
|
|
|
|
|
|
|
|
srs_assert(client);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client->conn->expire();
|
|
|
|
|
|
|
|
srs_warn("delete client=%d ok", cid);
|
|
|
|
|
|
|
|
return srs_http_response_code(w, ret);
|
|
|
|
|
|
|
|
} else if (r->is_http_get()) {
|
|
|
|
std::stringstream data;
|
|
|
|
std::stringstream data;
|
|
|
|
|
|
|
|
|
|
|
|
if (!client) {
|
|
|
|
if (!client) {
|
|
|
@ -751,6 +742,8 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return srs_http_response_json(w, ss.str());
|
|
|
|
return srs_http_response_json(w, ss.str());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|