mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #398, set recv timeout for http connection.
This commit is contained in:
parent
6f8c076b30
commit
46a81372e7
4 changed files with 13 additions and 1 deletions
|
@ -523,6 +523,10 @@ int SrsHttpApi::do_cycle()
|
|||
// underlayer socket
|
||||
SrsStSocket skt(stfd);
|
||||
|
||||
// set the recv timeout, for some clients never disconnect the connection.
|
||||
// @see https://github.com/simple-rtmp-server/srs/issues/398
|
||||
skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US);
|
||||
|
||||
// process http messages.
|
||||
for (;;) {
|
||||
SrsHttpMessage* req = NULL;
|
||||
|
|
|
@ -1383,6 +1383,10 @@ int SrsHttpConn::do_cycle()
|
|||
// underlayer socket
|
||||
SrsStSocket skt(stfd);
|
||||
|
||||
// set the recv timeout, for some clients never disconnect the connection.
|
||||
// @see https://github.com/simple-rtmp-server/srs/issues/398
|
||||
skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US);
|
||||
|
||||
// process http messages.
|
||||
for (;;) {
|
||||
SrsHttpMessage* req = NULL;
|
||||
|
|
|
@ -201,6 +201,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// query string seprator
|
||||
#define SRS_CONSTS_HTTP_QUERY_SEP '?'
|
||||
|
||||
// the default recv timeout.
|
||||
#define SRS_HTTP_RECV_TIMEOUT_US 60 * 1000 * 1000
|
||||
|
||||
// 6.1.1 Status Code and Reason Phrase
|
||||
#define SRS_CONSTS_HTTP_Continue 100
|
||||
#define SRS_CONSTS_HTTP_SwitchingProtocols 101
|
||||
|
|
|
@ -33,6 +33,7 @@ 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;
|
||||
|| error_code == ERROR_SOCKET_WRITE
|
||||
|| error_code == ERROR_SOCKET_TIMEOUT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue