Skip to content

Commit 8456368

Browse files
committed
Return actual packet size
1 parent d4e9282 commit 8456368

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/WiFi/src/WiFiUdp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int arduino::WiFiUDP::parsePacket() {
8686
_current_packet = _packet_buffer;
8787
_current_packet_size = ret;
8888

89-
return 1;
89+
return _current_packet_size;
9090
}
9191

9292
int arduino::WiFiUDP::available() {
@@ -106,7 +106,7 @@ int arduino::WiFiUDP::read() {
106106
// check for overflow
107107
if (_current_packet > _packet_buffer + _current_packet_size) {
108108
// try reading the next packet...
109-
if (parsePacket() == 1) {
109+
if (parsePacket() > 0) {
110110
// if so, read first byte of next packet;
111111
return read();
112112
}
@@ -141,7 +141,7 @@ int arduino::WiFiUDP::read(unsigned char* buffer, size_t len) {
141141
// at the end of the packet?
142142
if (max_bytes == 0) {
143143
// try read next packet...
144-
if (parsePacket() == 1) {
144+
if (parsePacket() > 0) {
145145
return read(buffer, len);
146146
}
147147
else {

0 commit comments

Comments
 (0)