]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix_http_esp32.c
esp32 http change timeout
[matrix_esp_thesis] / src / matrix_http_esp32.c
index 3faf9f5dd1aef66e5881ceaf90cacd67f89d7e05..2bdfb50466d494f7d2ad437324d500e128d2ebe9 100644 (file)
@@ -98,6 +98,7 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
             copy_len = MIN(evt->data_len, (hc->dataCap - hc->dataLen));
             if (copy_len) {
                 memcpy(hc->data + hc->dataLen, evt->data, copy_len);
+                hc->data[hc->dataLen + copy_len] = '\0';
             }
 
             hc->dataLen += copy_len;
@@ -140,7 +141,7 @@ MatrixHttpConnect(
 
     hc->client = esp_http_client_init(&config);
 
-    esp_http_client_set_timeout_ms(hc->client, 10000);
+    esp_http_client_set_timeout_ms(hc->client, 20000);
 }
 
 void
@@ -159,7 +160,6 @@ MatrixHttpInit(
     *hc = (MatrixHttpConnection *)calloc(1, sizeof(MatrixHttpConnection));
     
     (*hc)->host = host;
-    (*hc)->dataLen = 0;
 
     MatrixHttpConnect(*hc);