1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

eliminate wrong ringread due to peek (eliminated peek as well) - new version

This commit is contained in:
Harald Barth 2022-08-08 13:00:53 +02:00
parent 966b9594ef
commit f56e3bec9e
2 changed files with 5 additions and 5 deletions

View File

@ -1 +1 @@
#define GITHUB_SHA "PORTX-HAL-20220807-1"
#define GITHUB_SHA "PORTX-HAL-20220808"

View File

@ -268,7 +268,7 @@ void WifiESP::loop() {
WiThrottle::loop(outboundRing);
// something to write out?
clientId=outboundRing->peek();
clientId=outboundRing->read();
if (clientId >= 0) {
if ((unsigned int)clientId > clients.size()) {
// something is wrong with the ringbuffer position
@ -280,20 +280,20 @@ void WifiESP::loop() {
for(int i=0;i<count;i++) {
int c = outboundRing->read();
if (c < 0) {
DIAG(F("Ringread fail at %d"),i);
DIAG(F("Ringread fail in discarding data for client %d at pos %d"),clientId, i);
break;
}
}
outboundRing->info();
} else {
DIAG(F("No clientId where expected: Ring beyond rescue"));
}
DIAG(F("Ring beyond rescue"));
} else {
// We have data to send in outboundRing
// and we have a valid clientId.
// First read it out to buffer
// and then look if it can be sent because
// we can not leave it in the ring for ever
outboundRing->read(); // read over peek()
int count=outboundRing->count();
{
char buffer[count+1];