Dozingfiretruck 3 лет назад
Родитель
Сommit
5a5e7b77a5

+ 2 - 0
components/network/libhttp/luat_http.h

@@ -13,6 +13,8 @@
 #define HTTP_ERROR_RX 		(-6)
 #define HTTP_ERROR_DOWNLOAD (-7)
 
+#define HTTP_RE_REQUEST_MAX (3)
+
 typedef struct{
 	network_ctrl_t *netc;		// http netc
 	luat_ip_addr_t ip_addr;		// http ip

+ 1 - 1
components/network/libhttp/luat_http_client.c

@@ -126,7 +126,7 @@ static int32_t l_http_callback(lua_State *L, void* ptr){
 }
 
 static void http_resp_error(luat_http_ctrl_t *http_ctrl, int error_code) {
-	if (http_ctrl->close_state == 0 && http_ctrl->headers_complete && http_ctrl->re_request_count < 3){
+	if (http_ctrl->close_state == 0 && http_ctrl->headers_complete && http_ctrl->re_request_count < HTTP_RE_REQUEST_MAX){
 		http_ctrl->re_request_count++;
 #ifdef LUAT_USE_LWIP
 		if(network_connect(http_ctrl->netc, http_ctrl->host, strlen(http_ctrl->host), (0xff == http_ctrl->ip_addr.type)?NULL:&(http_ctrl->ip_addr), http_ctrl->remote_port, 0) < 0){