1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 23:56:13 +01:00

Cleaner purge on ERROR

This commit is contained in:
Asbelos 2020-10-27 11:04:51 +00:00
parent 6c0b5d82be
commit 138851f45f

View File

@ -85,7 +85,7 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
}
switch (loopState) {
case ANYTHING: // looking for +IPD, > , busy , n,CONNECTED, n,CLOSED, ERROR
case ANYTHING: // looking for +IPD, > , busy , n,CONNECTED, n,CLOSED, ERROR, SEND OK
if (ch == '+') {
loopState = IPD;
@ -109,6 +109,11 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
loopState=SKIPTOEND;
break;
}
if (ch=='S') { // SEND OK probably
loopState=SKIPTOEND;
break;
}
if (ch=='b') { // This is a busy indicator... probabaly must restart a CIPSEND
pendingCipsend=(clientPendingCIPSEND>=0);
@ -121,6 +126,18 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
loopState=GOT_CLIENT_ID;
break;
}
if (ch=='E') { // ERROR
if (pendingCipsend) {
// A CIPSEND was errored... just toss it away
if (Diag::WIFI) DIAG(F("Wifi: drop previous CIPSEND\n"));
for (int i=0;i<=currentReplySize;i++) outboundRing->read();
clientPendingCIPSEND=-1;
pendingCipsend=false;
}
loopState=SKIPTOEND;
break;
}
break;
@ -200,7 +217,9 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
// CLOSE
if (runningClientId==clientPendingCIPSEND) {
// clear the outbound for this client
for (int i=0;i<=currentReplySize;i++) outboundRing->read();
for (int i=0;i<=currentReplySize;i++) outboundRing->read();
clientPendingCIPSEND=-1;
pendingCipsend=false;
}
}
loopState=SKIPTOEND;