@@ -374,6 +374,8 @@ static int _http_client_recv(HTTPClient *client, char *buf, int min_len, int max
374374 else if (rc == QCLOUD_ERR_SSL_READ_TIMEOUT || rc == QCLOUD_ERR_TCP_READ_TIMEOUT ) {
375375 if (* p_read_len == client_data -> retrieve_len || client_data -> retrieve_len == 0 )
376376 rc = QCLOUD_ERR_SUCCESS ;
377+ else
378+ Log_e ("network_stack read timeout" );
377379 }
378380 else if (rc == QCLOUD_ERR_TCP_PEER_SHUTDOWN && * p_read_len > 0 ) {
379381 /* HTTP server give response and close this connection */
@@ -424,9 +426,11 @@ static int _http_client_retrieve_content(HTTPClient *client, char *data, int len
424426
425427 if (rc != QCLOUD_ERR_SUCCESS ) {
426428 IOT_FUNC_EXIT_RC (rc );
427- }else if (0 == left_ms (& timer )){
428- IOT_FUNC_EXIT_RC (QCLOUD_ERR_HTTP_TIMEOUT );
429- }
429+ }
430+ if (0 == left_ms (& timer )) {
431+ Log_e ("HTTP read timeout!" );
432+ IOT_FUNC_EXIT_RC (QCLOUD_ERR_HTTP_TIMEOUT );
433+ }
430434
431435 if (len == 0 ) {
432436 /* read no more data */
@@ -532,8 +536,10 @@ static int _http_client_retrieve_content(HTTPClient *client, char *data, int len
532536 rc = _http_client_recv (client , data , 1 , max_len , & len , left_ms (& timer ), client_data );
533537 if (rc != QCLOUD_ERR_SUCCESS ) {
534538 IOT_FUNC_EXIT_RC (rc );
535- }else if (0 == left_ms (& timer )){
536- IOT_FUNC_EXIT_RC (QCLOUD_ERR_HTTP_TIMEOUT );
539+ }
540+ if (left_ms (& timer ) == 0 ) {
541+ Log_e ("HTTP read timeout!" );
542+ IOT_FUNC_EXIT_RC (QCLOUD_ERR_HTTP_TIMEOUT );
537543 }
538544 }
539545 } while (readLen );
@@ -724,9 +730,7 @@ static int _http_client_recv_response(HTTPClient *client, uint32_t timeout_ms, H
724730
725731 if (rc != QCLOUD_ERR_SUCCESS ) {
726732 IOT_FUNC_EXIT_RC (rc );
727- }else if (0 == left_ms (& timer )){
728- IOT_FUNC_EXIT_RC (QCLOUD_ERR_HTTP_TIMEOUT );
729- }
733+ }
730734
731735 buf [reclen ] = '\0' ;
732736
0 commit comments