From 334845bfe3eb3a14a358ae0fef5208f5c5e5e636 Mon Sep 17 00:00:00 2001 From: "ethan.du" Date: Wed, 6 May 2020 15:33:59 +0800 Subject: [PATCH] bugfix remove useless timer --- uiot/utils/utils_httpc.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/uiot/utils/utils_httpc.c b/uiot/utils/utils_httpc.c index 62645c5..1ef3bcf 100644 --- a/uiot/utils/utils_httpc.c +++ b/uiot/utils/utils_httpc.c @@ -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 rc = SUCCESS_RET; - Timer timer; + int rc; - init_timer(&timer); - countdown_ms(&timer, timeout_ms); - - do - { - if ((NULL != client_data->response_buf) - && (0 != client_data->response_buf_len)) { - rc = _http_client_recv_response(client, timeout_ms, client_data); - } - if(client_data->is_more) - { - return SUCCESS_RET; + if ((NULL != client_data->response_buf) + && (0 != client_data->response_buf_len)) { + rc = _http_client_recv_response(client, timeout_ms, client_data); + if (rc < 0) { + LOG_ERROR("_http_client_recv_response is error, rc = %d", rc); + http_client_close(client); + return rc; } - }while((rc != SUCCESS_RET) && (!has_expired(&timer))); - return rc; + } + return SUCCESS_RET; } void http_client_close(http_client_t *client) {