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
|
@ -30,30 +30,26 @@
|
|||
#include <stdarg.h>
|
||||
using namespace std;
|
||||
|
||||
bool srs_is_system_control_error(int error_code)
|
||||
bool srs_is_system_control_error(srs_error_t err)
|
||||
{
|
||||
int error_code = srs_error_code(err);
|
||||
return error_code == ERROR_CONTROL_RTMP_CLOSE
|
||||
|| error_code == ERROR_CONTROL_REPUBLISH
|
||||
|| error_code == ERROR_CONTROL_REDIRECT;
|
||||
}
|
||||
|
||||
bool srs_is_system_control_error(srs_error_t err)
|
||||
bool srs_is_client_gracefully_close(srs_error_t err)
|
||||
{
|
||||
int error_code = srs_error_code(err);
|
||||
return srs_is_system_control_error(error_code);
|
||||
}
|
||||
|
||||
bool srs_is_client_gracefully_close(int error_code)
|
||||
{
|
||||
return error_code == ERROR_SOCKET_READ
|
||||
|| error_code == ERROR_SOCKET_READ_FULLY
|
||||
|| error_code == ERROR_SOCKET_WRITE;
|
||||
}
|
||||
|
||||
bool srs_is_client_gracefully_close(srs_error_t err)
|
||||
bool srs_is_server_gracefully_close(srs_error_t err)
|
||||
{
|
||||
int error_code = srs_error_code(err);
|
||||
return srs_is_client_gracefully_close(error_code);
|
||||
int code = srs_error_code(err);
|
||||
return code == ERROR_HTTP_STREAM_EOF;
|
||||
}
|
||||
|
||||
SrsCplxError::SrsCplxError()
|
||||
|
|
|
@ -320,6 +320,7 @@
|
|||
#define ERROR_HTTP_REQUEST_EOF 4029
|
||||
#define ERROR_HTTP_302_INVALID 4038
|
||||
#define ERROR_BASE64_DECODE 4039
|
||||
#define ERROR_HTTP_STREAM_EOF 4040
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// HTTP API error.
|
||||
|
@ -336,10 +337,11 @@
|
|||
|
||||
// Whether the error code is an system control error.
|
||||
// TODO: FIXME: Remove it from underlayer for confused with error and logger.
|
||||
extern bool srs_is_system_control_error(int error_code);
|
||||
extern bool srs_is_system_control_error(srs_error_t err);
|
||||
extern bool srs_is_client_gracefully_close(int error_code);
|
||||
// It's closed by client.
|
||||
extern bool srs_is_client_gracefully_close(srs_error_t err);
|
||||
// It's closed by server, such as streaming EOF.
|
||||
extern bool srs_is_server_gracefully_close(srs_error_t err);
|
||||
|
||||
// The complex error carries code, message, callstack and instant variables,
|
||||
// which is more strong and easy to locate problem by log,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue