1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refactor HTTP recv request timeout to 15s.

This commit is contained in:
winlin 2019-12-17 16:37:00 +08:00
parent 2df1dcb05a
commit 1e83da7812
3 changed files with 10 additions and 9 deletions

View file

@ -81,11 +81,9 @@ srs_error_t SrsHttpConn::do_cycle()
{
srs_error_t err = srs_success;
srs_trace("HTTP client ip=%s", ip.c_str());
// initialize parser
if ((err = parser->initialize(HTTP_REQUEST, false)) != srs_success) {
return srs_error_wrap(err, "init parser");
return srs_error_wrap(err, "init parser for %s", ip.c_str());
}
// set the recv timeout, for some clients never disconnect the connection.
@ -102,10 +100,12 @@ srs_error_t SrsHttpConn::do_cycle()
}
// process http messages.
while ((err = trd->pull()) == srs_success) {
ISrsHttpMessage* req = NULL;
for (int req_id = 0; (err = trd->pull()) == srs_success; req_id++) {
// Try to receive a message from http.
srs_trace("HTTP client ip=%s, request=%d, to=%dms", ip.c_str(), req_id, srsu2ms(SRS_HTTP_RECV_TIMEOUT));
// get a http message
ISrsHttpMessage* req = NULL;
if ((err = parser->parse_message(skt, &req)) != srs_success) {
break;
}