mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 03:55:58 +08:00
HTTP: 确保http请求结束后不再触发超时事件
This commit is contained in:
@@ -100,6 +100,7 @@ void HttpClient::clear() {
|
||||
}
|
||||
|
||||
void HttpClient::clearResponse() {
|
||||
_complete = false;
|
||||
_recved_body_size = 0;
|
||||
_total_body_size = 0;
|
||||
_parser.Clear();
|
||||
@@ -283,16 +284,21 @@ void HttpClient::onManager() {
|
||||
onResponseCompleted_l();
|
||||
}
|
||||
|
||||
if (_timeout_second > 0 && _total_timeout_ticker.elapsedTime() > _timeout_second * 1000) {
|
||||
if (waitResponse() && _timeout_second > 0 && _total_timeout_ticker.elapsedTime() > _timeout_second * 1000) {
|
||||
//超时
|
||||
shutdown(SockException(Err_timeout, "http request timeout"));
|
||||
}
|
||||
}
|
||||
|
||||
void HttpClient::onResponseCompleted_l() {
|
||||
_complete = true;
|
||||
onResponseCompleted();
|
||||
}
|
||||
|
||||
bool HttpClient::waitResponse() const {
|
||||
return !_complete && alive();
|
||||
}
|
||||
|
||||
void HttpClient::checkCookie(HttpClient::HttpHeader &headers) {
|
||||
//Set-Cookie: IPTV_SERVER=8E03927B-CC8C-4389-BC00-31DBA7EC7B49;expires=Sun, Sep 23 2018 15:07:31 GMT;path=/index/api/
|
||||
for (auto it_set_cookie = headers.find("Set-Cookie"); it_set_cookie != headers.end(); ++it_set_cookie) {
|
||||
|
||||
Reference in New Issue
Block a user