We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd3d0bf commit e0978e4Copy full SHA for e0978e4
libraries/Network/src/NetworkUdp.cpp
@@ -292,18 +292,14 @@ void NetworkUDP::flush() {}
292
293
int NetworkUDP::parsePacket() {
294
if (rx_buffer) {
295
- return 0;
+ if (rx_buffer->full()) { // packet was not read yet
296
+ return rx_buffer->available();
297
+ }
298
+ clear(); // discard the rest of the packet
299
}
300
struct sockaddr_storage si_other_storage; // enough storage for v4 and v6
301
socklen_t slen = sizeof(sockaddr_storage);
- int len = 0;
- if (ioctl(udp_server, FIONREAD, &len) == -1) {
- log_e("could not check for data in buffer length: %d", errno);
302
303
- }
304
- if (!len) {
305
306
+ int len;
307
char *buf = (char *)malloc(1460);
308
if (!buf) {
309
return 0;
0 commit comments