mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor HTTP stream to disconnect client when unpublish
This commit is contained in:
parent
1e83da7812
commit
191b07668d
7 changed files with 26 additions and 25 deletions
|
@ -181,10 +181,12 @@ srs_error_t SrsConnection::cycle()
|
|||
|
||||
// client close peer.
|
||||
// TODO: FIXME: Only reset the error when client closed it.
|
||||
if (srs_is_client_gracefully_close(srs_error_code(err))) {
|
||||
if (srs_is_client_gracefully_close(err)) {
|
||||
srs_warn("client disconnect peer. ret=%d", srs_error_code(err));
|
||||
} else if (srs_is_server_gracefully_close(err)) {
|
||||
srs_warn("server disconnect. ret=%d", srs_error_code(err));
|
||||
} else {
|
||||
srs_error("connect error %s", srs_error_desc(err).c_str());
|
||||
srs_error("serve error %s", srs_error_desc(err).c_str());
|
||||
}
|
||||
|
||||
srs_freep(err);
|
||||
|
|
|
@ -661,7 +661,9 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
|||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
// Here, the entry is disabled by encoder un-publishing or reloading,
|
||||
// so we must return a io.EOF error to disconnect the client, or the client will never quit.
|
||||
return srs_error_new(ERROR_HTTP_STREAM_EOF, "Stream EOF");
|
||||
}
|
||||
|
||||
srs_error_t SrsLiveStream::http_hooks_on_play(ISrsHttpMessage* r)
|
||||
|
|
|
@ -390,8 +390,8 @@ srs_error_t SrsRtmpConn::service_cycle()
|
|||
|
||||
// stream service must terminated with error, never success.
|
||||
// when terminated with success, it's user required to stop.
|
||||
if (srs_error_code(err) == ERROR_SUCCESS) {
|
||||
srs_freep(err);
|
||||
// TODO: FIXME: Support RTMP client timeout, https://github.com/ossrs/srs/issues/1134
|
||||
if (err == srs_success) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,10 +387,9 @@ srs_error_t SrsRtspConn::cycle()
|
|||
|
||||
if (err == srs_success) {
|
||||
srs_trace("client finished.");
|
||||
} else if (srs_is_client_gracefully_close(srs_error_code(err))) {
|
||||
} else if (srs_is_client_gracefully_close(err)) {
|
||||
srs_warn("client disconnect peer. code=%d", srs_error_code(err));
|
||||
srs_freep(err);
|
||||
err = srs_success;
|
||||
}
|
||||
|
||||
if (video_rtp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue