1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

replace socket.connected() with check for return value of socket.read()

This commit is contained in:
Harald Barth 2024-08-17 20:18:59 +02:00
parent c8c3697fa0
commit 048ba3fd1e

View File

@ -215,20 +215,16 @@ void EthernetInterface::loop2() {
CommandDistributor::parse(socket,buffer,outboundRing); CommandDistributor::parse(socket,buffer,outboundRing);
looptimer(2000, F("Ethloop2 parse")); looptimer(2000, F("Ethloop2 parse"));
return; // limit the amount of processing that takes place within 1 loop() cycle. return; // limit the amount of processing that takes place within 1 loop() cycle.
} } else if (count == 0) {
} // The client has disconnected
}
looptimer(8000, F("Ethloop2 after incoming"));
// stop any clients which disconnect
for (int socket = 0; socket<MAX_SOCK_NUM; socket++) {
if (clients[socket] && !clients[socket].connected()) {
clients[socket].stop(); clients[socket].stop();
CommandDistributor::forget(socket); CommandDistributor::forget(socket);
if (Diag::ETHERNET) DIAG(F("Ethernet: disconnect %d "), socket); if (Diag::ETHERNET) DIAG(F("Ethernet: disconnect %d "), socket);
} }
// fall through if count = -1 (no bytes available)
} }
looptimer(8000, F("Ethloop after disconnectcheck")); }
looptimer(8000, F("Ethloop2 after incoming"));
WiThrottle::loop(outboundRing); WiThrottle::loop(outboundRing);
looptimer(8000, F("Ethloop after Withrottleloop")); looptimer(8000, F("Ethloop after Withrottleloop"));