Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions canard.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,16 @@ int16_t canardHandleRxFrame(CanardInstance* ins, const CanardCANFrame* frame, ui
rx_state = findRxState(ins, transfer_descriptor);

if (rx_state == NULL)
{
return -CANARD_ERROR_RX_MISSED_START;
{
// we should return -CANARD_ERROR_RX_NOT_WANTED for
// non-start frames where we have rejected the start of
// transfer. doing it here avoids calling the potentially
// expensive should_accept() on every frame in messages we
// will be accepting
if (!ins->should_accept(ins, &data_type_signature, data_type_id, transfer_type, source_node_id)) {
return -CANARD_ERROR_RX_NOT_WANTED;
}
return -CANARD_ERROR_RX_MISSED_START;
}
}

Expand Down