mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
cleaning...
This commit is contained in:
parent
d95d9c193e
commit
b632088b19
|
@ -390,7 +390,7 @@ void WifiNINA::checkForLostClients() {
|
||||||
if(c && !c->connected()) {
|
if(c && !c->connected()) {
|
||||||
DIAG(F("Remove client %d"), clientId);
|
DIAG(F("Remove client %d"), clientId);
|
||||||
CommandDistributor::forget(clientId);
|
CommandDistributor::forget(clientId);
|
||||||
//delete c; // we have now finished with this client
|
//delete c; // this causes a crash when client drops.. commenting out for now
|
||||||
clients[clientId]=nullptr;
|
clients[clientId]=nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,24 +412,22 @@ void WifiNINA::checkForClientInput() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiNINA::checkForClientOutput() {
|
void WifiNINA::checkForClientOutput() {
|
||||||
// something to write out?
|
// something to write out?
|
||||||
auto clientId=outboundRing->read();
|
auto clientId=outboundRing->read();
|
||||||
if (clientId < 0) return;
|
if (clientId < 0) return;
|
||||||
auto replySize=outboundRing->count();
|
auto replySize=outboundRing->count();
|
||||||
if (replySize==0) return; // nothing to send
|
if (replySize==0) return; // nothing to send
|
||||||
|
|
||||||
auto c=clients[clientId];
|
auto c=clients[clientId];
|
||||||
if (!c) {
|
if (!c) {
|
||||||
// client is gone, throw away msg
|
// client is gone, throw away msg
|
||||||
for (int i=0;i<replySize;i++) outboundRing->read();
|
for (int i=0;i<replySize;i++) outboundRing->read();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// emit data to the client object
|
// emit data to the client object
|
||||||
// This should work in theory, the
|
// This should work in theory, the
|
||||||
for (int i=0;i<replySize;i++) c->write(outboundRing->read());
|
for (int i=0;i<replySize;i++) c->write(outboundRing->read());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiNINA::loop() {
|
void WifiNINA::loop() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user