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:
parent
2df1dcb05a
commit
1e83da7812
3 changed files with 10 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -610,6 +610,7 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
|||
enc->has_cache(), msgs.max);
|
||||
|
||||
// TODO: free and erase the disabled entry after all related connections is closed.
|
||||
// TODO: FXIME: Support timeout for player, quit infinite-loop.
|
||||
while (entry->enabled) {
|
||||
pprint->elapse();
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
#define SRS_CONSTS_HTTP_QUERY_SEP '?'
|
||||
|
||||
// The default recv timeout.
|
||||
#define SRS_HTTP_RECV_TIMEOUT (60 * SRS_UTIME_SECONDS)
|
||||
#define SRS_HTTP_RECV_TIMEOUT (15 * SRS_UTIME_SECONDS)
|
||||
|
||||
// 6.1.1 Status Code and Reason Phrase
|
||||
#define SRS_CONSTS_HTTP_Continue 100
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue