mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #442, support kickoff client.
This commit is contained in:
parent
b37797b13a
commit
94641c812b
11 changed files with 57 additions and 46 deletions
|
@ -660,22 +660,8 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
srs_error("stream stream_id=%d not found. ret=%d", sid, ret);
|
||||
return srs_http_response_code(w, ret);
|
||||
}
|
||||
|
||||
if (r->is_http_delete()) {
|
||||
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()) {
|
||||
|
||||
if (r->is_http_get()) {
|
||||
std::stringstream data;
|
||||
|
||||
if (!stream) {
|
||||
|
@ -726,10 +712,15 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
ret = ERROR_RTMP_STREAM_NOT_FOUND;
|
||||
srs_error("stream client_id=%d not found. ret=%d", cid, 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;
|
||||
|
||||
if (!client) {
|
||||
|
@ -751,6 +742,8 @@ int SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
}
|
||||
|
||||
return srs_http_response_json(w, ss.str());
|
||||
} else {
|
||||
return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue