From 803db81c8f2d20d91be0b84b930fe0048b86ca0c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 6 Aug 2022 19:07:35 +0200 Subject: [PATCH] try to recover from ringbuffer read problem --- WifiESP32.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/WifiESP32.cpp b/WifiESP32.cpp index 22a02ca..917785e 100644 --- a/WifiESP32.cpp +++ b/WifiESP32.cpp @@ -236,6 +236,17 @@ void WifiESP::loop() { if (clientId >= 0) { if ((unsigned int)clientId > clients.size()) { // something is wrong with the ringbuffer position + // or client has disconnected + outboundRing->info(); + // try to recover by reading out to nowhere + int count=outboundRing->count(); + for(int i=0;iread(); + if (c < 0) { + DIAG(F("Ringread fail at %d"),i); + break; + } + } outboundRing->info(); } else { // we have data to send in outboundRing