Fixed bug in parsePacket where it could block indefinitely if called when no packets were available to be read.

This commit is contained in:
amcewen 2011-02-04 21:44:51 +00:00
parent 4000c9199b
commit 7f18110b80
1 changed files with 17 additions and 12 deletions

View File

@ -121,6 +121,8 @@ void UDP::write(const uint8_t *buffer, size_t size)
int UDP::parsePacket()
{
if (available() > 0)
{
//HACK - hand-parse the UDP packet using TCP recv method
uint8_t tmpBuf[8];
int ret =0;
@ -135,6 +137,9 @@ int UDP::parsePacket()
ret = available();
}
return ret;
}
// There aren't any packets available
return 0;
}
int UDP::read()