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

scan earlier for dead Ethernet connections

This commit is contained in:
Harald Barth 2024-01-27 21:29:25 +01:00
parent 08c89f743f
commit 4d3dffacb4

View File

@ -239,6 +239,12 @@ void EthernetInterface::loop2() {
for (byte socket = 0; socket < MAX_SOCK_NUM; socket++) for (byte socket = 0; socket < MAX_SOCK_NUM; socket++)
{ {
if (clients[socket]) { if (clients[socket]) {
if (!clients[socket].connected()) { // stop any clients which disconnect
CommandDistributor::forget(socket);
clients[socket].stop();
//if (Diag::ETHERNET)
DIAG(F("Ethernet: disconnect %d "), socket);
}
int available=clients[socket].available(); int available=clients[socket].available();
if (available > 0) { if (available > 0) {
@ -254,15 +260,6 @@ void EthernetInterface::loop2() {
} }
} }
// stop any clients which disconnect
for (int socket = 0; socket<MAX_SOCK_NUM; socket++) {
if (clients[socket] && !clients[socket].connected()) {
clients[socket].stop();
CommandDistributor::forget(socket);
if (Diag::ETHERNET) DIAG(F("Ethernet: disconnect %d "), socket);
}
}
WiThrottle::loop(outboundRing); WiThrottle::loop(outboundRing);
// handle at most 1 outbound transmission // handle at most 1 outbound transmission