Skip to content

Commit b8828d5

Browse files
authored
Always update socketRecAvailable when called
1 parent 78aeaf5 commit b8828d5

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/socket.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,11 @@ int EthernetClass::socketRecv(uint8_t s, uint8_t *buf, int16_t len)
349349

350350
uint16_t EthernetClass::socketRecvAvailable(uint8_t s)
351351
{
352-
uint16_t ret = state[s].RX_RSR;
353-
if (ret == 0) {
354-
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
355-
uint16_t rsr = getSnRX_RSR(s);
356-
SPI.endTransaction();
357-
ret = rsr - state[s].RX_inc;
358-
state[s].RX_RSR = ret;
359-
//Serial.printf("sockRecvAvailable s=%d, RX_RSR=%d\n", s, ret);
360-
}
361-
return ret;
352+
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
353+
uint16_t rsr = getSnRX_RSR(s);
354+
SPI.endTransaction();
355+
state[s].RX_RSR = rsr - state[s].RX_inc;
356+
return state[s].RX_RSR;
362357
}
363358

364359
// get the first byte in the receive queue (no checking)

0 commit comments

Comments
 (0)