Skip to content

Commit

Permalink
Account for delay when dropping a message to be forwarded to a transi…
Browse files Browse the repository at this point in the history
…ent federate
  • Loading branch information
ChadliaJerad committed Dec 16, 2024
1 parent 34d51b3 commit 1e5e441
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,10 +664,18 @@ void handle_timed_message(federate_info_t* sending_federate, unsigned char* buff
LF_MUTEX_LOCK(&rti_mutex);

// If the destination federate is no longer connected, or it is a transient that has not started executing yet
// (the intended tag is less than the effective start tag of the destination), issue a warning, remove the message
// from the socket, and return.
// (the delayed intended tag is less than the effective start tag of the destination), issue a warning, remove the
// message from the socket, and return.
federate_info_t* fed = GET_FED_INFO(federate_id);
if (fed->enclave.state == NOT_CONNECTED || lf_tag_compare(intended_tag, fed->effective_start_tag) < 0) {
interval_t delay = NEVER;
for (int i = 0; i < fed->enclave.num_upstream; i++) {
if (fed->enclave.upstream[i] == sending_federate->enclave.id) {
delay = fed->enclave.upstream_delay[i];
break;
}
}
if (fed->enclave.state == NOT_CONNECTED ||
lf_tag_compare(lf_delay_tag(intended_tag, delay), fed->effective_start_tag) < 0) {
lf_print_warning("RTI: Destination federate %d is not connected at logical time (" PRINTF_TAG
"). Dropping message.",
federate_id, intended_tag.time - start_time, intended_tag.microstep);
Expand Down

0 comments on commit 1e5e441

Please sign in to comment.