1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +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;
@ -110,6 +110,11 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
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);
loopState=SKIPTOEND;
@ -122,6 +127,18 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
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;
case IPD: // Looking for I in +IPD
@ -201,6 +218,8 @@ WifiInboundHandler::INBOUND_STATE WifiInboundHandler::loop2() {
if (runningClientId==clientPendingCIPSEND) {
// clear the outbound for this client
for (int i=0;i<=currentReplySize;i++) outboundRing->read();
clientPendingCIPSEND=-1;
pendingCipsend=false;
}
}
loopState=SKIPTOEND;