mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
try to recover from ringbuffer read problem
This commit is contained in:
parent
42c35a11e1
commit
803db81c8f
@ -236,6 +236,17 @@ void WifiESP::loop() {
|
|||||||
if (clientId >= 0) {
|
if (clientId >= 0) {
|
||||||
if ((unsigned int)clientId > clients.size()) {
|
if ((unsigned int)clientId > clients.size()) {
|
||||||
// something is wrong with the ringbuffer position
|
// 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;i<count;i++) {
|
||||||
|
int c = outboundRing->read();
|
||||||
|
if (c < 0) {
|
||||||
|
DIAG(F("Ringread fail at %d"),i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
outboundRing->info();
|
outboundRing->info();
|
||||||
} else {
|
} else {
|
||||||
// we have data to send in outboundRing
|
// we have data to send in outboundRing
|
||||||
|
Loading…
Reference in New Issue
Block a user