mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Fixed bug in parsePacket where it could block indefinitely if called when no packets were available to be read.
This commit is contained in:
@ -120,6 +120,8 @@ void UDP::write(const uint8_t *buffer, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int UDP::parsePacket()
|
int UDP::parsePacket()
|
||||||
|
{
|
||||||
|
if (available() > 0)
|
||||||
{
|
{
|
||||||
//HACK - hand-parse the UDP packet using TCP recv method
|
//HACK - hand-parse the UDP packet using TCP recv method
|
||||||
uint8_t tmpBuf[8];
|
uint8_t tmpBuf[8];
|
||||||
@ -136,6 +138,9 @@ int UDP::parsePacket()
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
// There aren't any packets available
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int UDP::read()
|
int UDP::read()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user