Skip to content

Commit

Permalink
send whole outbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
habazut committed Aug 9, 2024
1 parent 690c629 commit 127f3ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion EthernetInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ void EthernetInterface::loop2() {
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"));
buffer[count] = '\0'; // terminate the string properly
if (Diag::ETHERNET) DIAG(F(",count=%d:%e"), count, buffer);
// execute with data going directly back
Expand Down Expand Up @@ -239,7 +240,14 @@ void EthernetInterface::loop2() {
} else if (socketOut >= 0) {
int count=outboundRing->count();
if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d"), socketOut,count);
for(;count>0;count--) clients[socketOut].write(outboundRing->read());
{
char buffer[count+1]; // one extra for '\0'
for(int i=0;i<count;i++) {
buffer[i] = outboundRing->read();
}
buffer[count]=0;
clients[socketOut].write(buffer,count);
}
clients[socketOut].flush(); //maybe
}
looptimer(8000, F("Ethloop after outbound"));
Expand Down
2 changes: 1 addition & 1 deletion GITHUB_SHA.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define GITHUB_SHA "devel-fozzie-202408080852Z"
#define GITHUB_SHA "devel-fozzie-202408090945Z"

0 comments on commit 127f3ac

Please sign in to comment.