bugfix remove useless timer

This commit is contained in:
ethan.du 2020-05-06 15:33:59 +08:00
parent 67b5b64200
commit 334845bfe3
1 changed files with 10 additions and 16 deletions

View File

@ -508,24 +508,18 @@ int http_client_common(http_client_t *client, const char *url, int port, const c
} }
int http_client_recv_data(http_client_t *client, uint32_t timeout_ms, http_client_data_t *client_data) { int http_client_recv_data(http_client_t *client, uint32_t timeout_ms, http_client_data_t *client_data) {
int rc = SUCCESS_RET; int rc;
Timer timer;
init_timer(&timer); if ((NULL != client_data->response_buf)
countdown_ms(&timer, timeout_ms); && (0 != client_data->response_buf_len)) {
rc = _http_client_recv_response(client, timeout_ms, client_data);
do if (rc < 0) {
{ LOG_ERROR("_http_client_recv_response is error, rc = %d", rc);
if ((NULL != client_data->response_buf) http_client_close(client);
&& (0 != client_data->response_buf_len)) { return rc;
rc = _http_client_recv_response(client, timeout_ms, client_data);
}
if(client_data->is_more)
{
return SUCCESS_RET;
} }
}while((rc != SUCCESS_RET) && (!has_expired(&timer))); }
return rc; return SUCCESS_RET;
} }
void http_client_close(http_client_t *client) { void http_client_close(http_client_t *client) {