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

Compare commits

..

No commits in common. "92288603bfefa75561180dc39151e4bbbc6ce054" and "e328ea5c5d1f557420e61791b08983cbef67813e" have entirely different histories.

2 changed files with 11 additions and 27 deletions

View File

@ -30,8 +30,6 @@
#include "WiThrottle.h"
#include "DCCTimer.h"
extern void looptimer(unsigned long timeout, const FSH* message);
EthernetInterface * EthernetInterface::singleton=NULL;
/**
* @brief Setup Ethernet Connection
@ -127,7 +125,6 @@ void EthernetInterface::loop()
//nothing happened
break;
}
looptimer(8000, F("Ethloop after maintain"));
singleton->loop2();
}
@ -204,21 +201,19 @@ void EthernetInterface::loop2() {
{
if (clients[socket]) {
int available=clients[socket].available();
if (available > 0) {
if (Diag::ETHERNET) DIAG(F("Ethernet: available socket=%d,avail=%d"), socket, available);
// read bytes from a client
int count = clients[socket].read(buffer, MAX_ETH_BUFFER);
looptimer(8000, F("Ethloop2 read"));
if (count > 0) {
if (Diag::ETHERNET) DIAG(F("Ethernet: available socket=%d,count=%d"), socket, count);
buffer[count] = '\0'; // terminate the string properly
if (Diag::ETHERNET) DIAG(F("buffer:%e"), buffer);
if (Diag::ETHERNET) DIAG(F(",count=%d:%e"), socket,buffer);
// execute with data going directly back
CommandDistributor::parse(socket,buffer,outboundRing);
looptimer(2000, F("Ethloop2 parse"));
return; // limit the amount of processing that takes place within 1 loop() cycle.
}
}
}
looptimer(8000, F("Ethloop2 after incoming"));
// stop any clients which disconnect
for (int socket = 0; socket<MAX_SOCK_NUM; socket++) {
@ -228,10 +223,8 @@ void EthernetInterface::loop2() {
if (Diag::ETHERNET) DIAG(F("Ethernet: disconnect %d "), socket);
}
}
looptimer(8000, F("Ethloop after disconnectcheck"));
WiThrottle::loop(outboundRing);
looptimer(8000, F("Ethloop after Withrottleloop"));
// handle at most 1 outbound transmission
int socketOut=outboundRing->read();
@ -240,17 +233,8 @@ void EthernetInterface::loop2() {
} else if (socketOut >= 0) {
int count=outboundRing->count();
if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d"), socketOut,count);
{
char tmpbuf[count+1]; // one extra for '\0'
for(int i=0;i<count;i++) {
tmpbuf[i] = outboundRing->read();
}
tmpbuf[count]=0;
clients[socketOut].write(tmpbuf,count);
}
for(;count>0;count--) clients[socketOut].write(outboundRing->read());
clients[socketOut].flush(); //maybe
}
looptimer(8000, F("Ethloop after outbound"));
}
#endif

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-fozzie-202408090945Z"
#define GITHUB_SHA "devel-fozzie-202408080852Z"