Skip to content

Commit

Permalink
Fix bug in previous commit.
Browse files Browse the repository at this point in the history
The problem was that the NET obtained by get_next_event_tag might be
farther into the future than the NET that was just submitted to the RTI.
This is possible when executing the start tag because all federates send
a NET for the start tag regardless of their event queues.
  • Loading branch information
petervdonovan committed Aug 31, 2023
1 parent b5b996b commit 49483cf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/federated/federate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2743,15 +2743,18 @@ tag_t _lf_send_next_event_tag(environment_t* env, tag_t tag, bool wait_for_reply
}
// Check whether the new event on the event queue requires sending a new NET.
tag_t next_tag = get_next_event_tag(env);
if (
lf_tag_compare(_fed.last_TAG, next_tag) >= 0
|| lf_tag_compare(_fed.last_TAG, tag) >= 0
) {
return _fed.last_TAG;
}
if (lf_tag_compare(next_tag, tag) != 0) {
_lf_send_tag(MSG_TYPE_NEXT_EVENT_TAG, next_tag, wait_for_reply);
_fed.last_sent_NET = next_tag;
LF_PRINT_LOG("Sent next event tag (NET) " PRINTF_TAG " to RTI from loop.",
next_tag.time - lf_time_start(), next_tag.microstep);
}
if (lf_tag_compare(_fed.last_TAG, next_tag) >= 0) {
return _fed.last_TAG;
}
}
}

Expand Down

0 comments on commit 49483cf

Please sign in to comment.