1
0
Fork 0

note that 0 sequences can expose bugs

This commit is contained in:
Kevin Matz 2021-08-29 11:18:45 -04:00
parent 66b6c8e7e4
commit 7a0fbb0e41
1 changed files with 10 additions and 6 deletions

View File

@ -232,14 +232,18 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
/// > is less than or equal to 0, but greater than -20,
/// > then the packet containing sequence number B shall be deemed out of
/// > sequence and discarded.
/// \bug The standard requires that transmitters send incrimenting sequence
/// numbers, but many sources do not. By tolerating out-of-spec sources
/// transmitting 0s instead of a sequence number, the receiver must operate
/// in a mode where it cannnot detect missing or out-of-sequence packets.
auto a = universe->provenance()->sequence_number;
auto b = source->sequence_number;
int8_t dif = b - a;
if (dif <= 0 && dif > -20)
/// Tolerate out-of-spec sources transmitting 0s instead of a sequence number.
if (!(a == 0 && b == 0))
return;
if (!(a == 0 && b == 0))
{
int8_t dif = b - a;
if (dif <= 0 && dif > -20)
return;
}
// PDU data will be a block of DMP
auto block = static_cast<ACN::PDU::Block<ACN::DMP::Pdu>*>(frame->data());