Skip to content

Commit 17a1b7b

Browse files
committed
avoid looping when packet is fully parsed
as reported in #127
1 parent ca5c3f6 commit 17a1b7b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/AppleMIDI.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ void AppleMIDISession<UdpClass, Settings, Platform>::parseControlPackets()
3030
while (controlBuffer.size() > 0)
3131
{
3232
auto retVal = _appleMIDIParser.parse(controlBuffer, amPortType::Control);
33-
if (retVal == parserReturn::UnexpectedData)
33+
if (retVal == parserReturn::Processed
34+
|| retVal == parserReturn::NotEnoughData
35+
|| retVal == parserReturn::NotSureGiveMeMoreData)
36+
{
37+
break;
38+
}
39+
else if (retVal == parserReturn::UnexpectedData)
3440
{
3541
#ifdef USE_EXT_CALLBACKS
3642
if (nullptr != _exceptionCallback)

0 commit comments

Comments
 (0)