fix TLS multiple-record-per-frame handling in bare metal

This commit is contained in:
Sergio R. Caprile committed 2025-01-24 12:05:17 -03:00
1 parent bf592a22ae
commit 8de9699390
5 files changed
+25 -39

No files matched your search

+2 -1
View File
@@ -198,6 +198,8 @@ static int fetch(struct mg_mgr *mgr, char *buf, const char *url,
mg_vprintf(c, fmt, &ap);
va_end(ap);
buf[0] = '\0';
// - TLS: multiple (small) records: allow enough loops so mg_mgr_poll can
// process buffered records when no more frames are coming in
for (i = 0; i < 500 && buf[0] == '\0' && !fd.closed; i++) {
mg_mgr_poll(mgr, 0);
usleep(5000); // 5 ms. Slow down poll loop to ensure packet transit, but
@@ -403,7 +405,6 @@ int main(void) {
// Events
struct mg_mgr mgr; // Event manager
mg_log_set(MG_LL_DEBUG);
mg_mgr_init(&mgr); // Initialise event manager
// MIP driver