Skip to content

Commit 2e50c1c

Browse files
committed
fix:NetworkUDP - in parsePacket handle previous parsed packet
1 parent cd3d0bf commit 2e50c1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/Network/src/NetworkUdp.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ void NetworkUDP::flush() {}
292292

293293
int NetworkUDP::parsePacket() {
294294
if (rx_buffer) {
295-
return 0;
295+
if (rx_buffer->full()) { // packet was not read yet
296+
return rx_buffer->available();
297+
}
298+
clear(); // discard the rest of the packet
296299
}
297300
struct sockaddr_storage si_other_storage; // enough storage for v4 and v6
298301
socklen_t slen = sizeof(sockaddr_storage);

0 commit comments

Comments
 (0)