1
0
Fork 0

strictly enforce recieved sequence numbers

This commit is contained in:
Kevin Matz 2022-12-08 17:56:02 -05:00
parent 8a83107ee7
commit 85a7ec4762
2 changed files with 4 additions and 16 deletions

View File

@ -253,21 +253,11 @@ 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 some sources may not. By tolerating out-of-spec sources
/// transmitting 0s instead of a sequence number, the receiver may operate
/// in a mode where it cannnot detect missing or out-of-sequence packets.
/// This also prevents the rejection of messages recieved on both IPv4 and
/// IPv6, which violates the reciever requiement in \cite sACN 9.1 Association
/// of Multicast Addresses and Universe requirement.
auto a = universe->metadata()->sequence_number;
auto b = metadata->sequence_number;
if (!(a == 0 && b == 0))
{
int dif = b - a;
if (dif <= 0 && dif > -20)
return;
}
int dif = b - a;
if (dif <= 0 && dif > -20)
return; // too far out of sequence
// PDU data will be a block of DMP
auto block = std::static_pointer_cast<ACN::PDU::Block<ACN::DMP::Pdu>>(frame->data());

View File

@ -312,9 +312,7 @@ void Universe::synchronize(uint8_t sequence_number)
auto b = 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;
return;
sync_sequence_ = sequence_number;
DMX::Universe::setData(*sync_data_);