diff --git a/core/federated/RTI/message_record/message_record.c b/core/federated/RTI/message_record/message_record.c index 6d4c278d4..db5d946c8 100644 --- a/core/federated/RTI/message_record/message_record.c +++ b/core/federated/RTI/message_record/message_record.c @@ -160,11 +160,13 @@ tag_t get_minimum_in_transit_message_tag(in_transit_message_record_q_t* queue) { // Empty the transfer queue (which holds messages with equal time but larger microstep) into the main queue. pqueue_empty_into(&queue->main_queue, &queue->transfer_queue); - LF_PRINT_DEBUG( - "RTI: Minimum tag of all in-transit messages: (%ld, %u).", - head_of_in_transit_messages->tag.time - lf_time_start(), - head_of_in_transit_messages->tag.microstep - ); + if (head_of_in_transit_messages != NULL) { + LF_PRINT_DEBUG( + "RTI: Minimum tag of all in-transit messages: (%ld, %u).", + head_of_in_transit_messages->tag.time - lf_time_start(), + head_of_in_transit_messages->tag.microstep + ); + } return minimum_tag; } diff --git a/core/federated/RTI/rti.c b/core/federated/RTI/rti.c index 82295f745..a2ce7d553 100644 --- a/core/federated/RTI/rti.c +++ b/core/federated/RTI/rti.c @@ -1752,6 +1752,8 @@ int receive_udp_message_and_set_up_clock_sync(int socket_id, uint16_t fed_id) { if (_RTI.clock_sync_global_status >= clock_sync_init) {// If no initial clock sync, no need perform initial clock sync. uint16_t federate_UDP_port_number = extract_uint16(&(response[1])); + LF_PRINT_DEBUG("RTI got MSG_TYPE_UDP_PORT %u from federate %d.", federate_UDP_port_number, fed_id); + // A port number of UINT16_MAX means initial clock sync should not be performed. if (federate_UDP_port_number != UINT16_MAX) { // Perform the initialization clock synchronization with the federate. diff --git a/core/federated/clock-sync.c b/core/federated/clock-sync.c index 8ef6a11f7..0419743f4 100644 --- a/core/federated/clock-sync.c +++ b/core/federated/clock-sync.c @@ -140,8 +140,8 @@ void reset_socket_stat(struct socket_stat_t* socket_stat) { * If clock synchronization is set to on, a reserved UDP port number * will be sent. */ -ushort setup_clock_synchronization_with_rti() { - ushort port_to_return = USHRT_MAX; +uint16_t setup_clock_synchronization_with_rti() { + uint16_t port_to_return = UINT16_MAX; #ifdef _LF_CLOCK_SYNC_ON // Initialize the UDP socket _lf_rti_socket_UDP = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/core/threaded/scheduler_adaptive.c b/core/threaded/scheduler_adaptive.c index ebb4efffe..718072925 100644 --- a/core/threaded/scheduler_adaptive.c +++ b/core/threaded/scheduler_adaptive.c @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * This is a non-priority-driven scheduler. See scheduler.h for documentation. * @author{Peter Donovan } */ +#if defined SCHEDULER && SCHEDULER == adaptive #ifndef NUMBER_OF_WORKERS #define NUMBER_OF_WORKERS 1 #endif // NUMBER_OF_WORKERS @@ -125,3 +126,4 @@ void lf_sched_trigger_reaction(reaction_t* reaction, int worker_number) { if (!lf_bool_compare_and_swap(&reaction->status, inactive, queued)) return; worker_assignments_put(reaction); } +#endif // defined SCHEDULER && SCHEDULER == ADAPTIVE diff --git a/include/core/federated/clock-sync.h b/include/core/federated/clock-sync.h index 776e77873..a083c1e4e 100644 --- a/include/core/federated/clock-sync.h +++ b/include/core/federated/clock-sync.h @@ -132,7 +132,7 @@ void reset_socket_stat(struct socket_stat_t* socket_stat); * * @return port number to be sent to the RTI */ -unsigned short int setup_clock_synchronization_with_rti(void); +uint16_t setup_clock_synchronization_with_rti(void); /** * Synchronize the initial physical clock with the RTI. diff --git a/include/core/reactor.h b/include/core/reactor.h index dfa445dcd..d047cec47 100644 --- a/include/core/reactor.h +++ b/include/core/reactor.h @@ -85,6 +85,12 @@ lf_token_t* _lf_initialize_token_with_value(lf_token_t* token, void* value, size void _lf_set_present(lf_port_base_t* port); +/** + * @brief Forward declaration for the executable preamble; + * + */ +void _lf_executable_preamble(); + /** * Set the specified output (or input of a contained reactor) * to the specified value. diff --git a/include/core/threaded/data_collection.h b/include/core/threaded/data_collection.h index cf00a007e..d40c40901 100644 --- a/include/core/threaded/data_collection.h +++ b/include/core/threaded/data_collection.h @@ -160,6 +160,7 @@ static void data_collection_end_level(size_t level, size_t num_workers) { } static size_t restrict_to_range(size_t start_inclusive, size_t end_inclusive, size_t value) { + assert(start_inclusive <= end_inclusive); if (value < start_inclusive) return start_inclusive; if (value > end_inclusive) return end_inclusive; return value; @@ -194,6 +195,7 @@ static void compute_number_of_workers( int minimum_workers = 1; #ifdef WORKERS_NEEDED_FOR_FEDERATE // TODO: only apply this constraint on levels containing control reactions + assert(WORKERS_NEEDED_FOR_FEDERATE >= 1); minimum_workers = WORKERS_NEEDED_FOR_FEDERATE > max_reasonable_num_workers ? max_reasonable_num_workers : WORKERS_NEEDED_FOR_FEDERATE; #endif diff --git a/lingua-franca-ref.txt b/lingua-franca-ref.txt index e07b6393d..ef4e81e4f 100644 --- a/lingua-franca-ref.txt +++ b/lingua-franca-ref.txt @@ -1 +1 @@ -e95aedf149fa409ca65eb439b92e499705480882 \ No newline at end of file +fed-gen