@@ -84,7 +84,8 @@ void StartupCoordinator_schedule_timers(StartupCoordinator *self, const Reactor
8484 }
8585}
8686
87- void StartupCoordinator_schedule_timers_joining (StartupCoordinator * self , Reactor * reactor , interval_t federation_start_time , interval_t join_time ) {
87+ void StartupCoordinator_schedule_timers_joining (StartupCoordinator * self , Reactor * reactor ,
88+ interval_t federation_start_time , interval_t join_time ) {
8889 lf_ret_t ret ;
8990 for (size_t i = 0 ; i < reactor -> triggers_size ; i ++ ) {
9091 Trigger * trigger = reactor -> triggers [i ];
@@ -377,7 +378,7 @@ static void StartupCoordinator_handle_start_time_proposal(StartupCoordinator *se
377378}
378379
379380static void StartupCoordinator_handle_start_time_request (StartupCoordinator * self , StartupEvent * payload ) {
380- FederatedEnvironment * env = (FederatedEnvironment * )self -> env ;
381+ FederatedEnvironment * env = (FederatedEnvironment * )self -> env ;
381382 if (payload -> neighbor_index == NEIGHBOR_INDEX_SELF ) {
382383 for (size_t i = 0 ; i < self -> num_neighbours ; i ++ ) {
383384 NetworkChannel * chan = env -> net_bundles [i ]-> net_channel ;
@@ -390,7 +391,7 @@ static void StartupCoordinator_handle_start_time_request(StartupCoordinator *sel
390391
391392 // We now schedule a system event here, because otherwise we will never detect no other federates responding
392393 StartupCoordinator_schedule_system_self_event (self , self -> env -> get_physical_time (self -> env ) + MSEC (250 ),
393- StartupCoordination_start_time_response_tag );
394+ StartupCoordination_start_time_response_tag );
394395 }
395396
396397 } else {
@@ -404,18 +405,16 @@ static void StartupCoordinator_handle_start_time_request(StartupCoordinator *sel
404405 self -> env -> get_elapsed_logical_time (self -> env );
405406 msg -> message .startup_coordination .message .start_time_response .federation_start_time = self -> start_time_proposal ;
406407 chan -> send_blocking (chan , msg );
407- LF_INFO (FED , "SENDING TIME start_tag: " PRINTF_TIME " elapsed_time: " PRINTF_TIME ,
408- msg -> message .startup_coordination .message .start_time_response .federation_start_time ,
409- msg -> message .startup_coordination .message .start_time_response .elapsed_logical_time );
408+ LF_INFO (FED , "SENDING TIME start_tag: " PRINTF_TIME " elapsed_time: " PRINTF_TIME ,
409+ msg -> message .startup_coordination .message .start_time_response .federation_start_time ,
410+ msg -> message .startup_coordination .message .start_time_response .elapsed_logical_time );
410411 break ;
411412 }
412413 default :;
413414 }
414415 }
415416}
416417
417-
418-
419418static void StartupCoordinator_handle_start_time_response (StartupCoordinator * self , StartupEvent * payload ) {
420419 if (self -> start_time_proposal > 0 ) {
421420 return ;
@@ -462,23 +461,23 @@ static void StartupCoordinator_handle_start_time_response(StartupCoordinator *se
462461 instant_t joining_time = 0 ;
463462
464463 if (self -> joining_policy == JOIN_IMMEDIATELY ) {
465- joining_time = max_logical_time + MSEC (50 );
466- tag_t start_tag = {.time = joining_time , .microstep = 0 };
467- LF_INFO (FED , "Policy: IMMEDIATELY Scheduling join_time: " PRINTF_TIME , joining_time );
468- self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , NEVER_TAG );
469- StartupCoordinator_schedule_startups (self , start_tag );
470- StartupCoordinator_schedule_timers (self , self -> env -> main , start_tag );
471- self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
472- self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
464+ joining_time = max_logical_time + MSEC (50 );
465+ tag_t start_tag = {.time = joining_time , .microstep = 0 };
466+ LF_INFO (FED , "Policy: IMMEDIATELY Scheduling join_time: " PRINTF_TIME , joining_time );
467+ self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , NEVER_TAG );
468+ StartupCoordinator_schedule_startups (self , start_tag );
469+ StartupCoordinator_schedule_timers (self , self -> env -> main , start_tag );
470+ self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
471+ self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
473472 } else if (self -> joining_policy == JOIN_ALIGNED_WITH_SHORT_TIMER ) {
474- joining_time = max_logical_time + MSEC (50 );
475- tag_t start_tag = {.time = joining_time , .microstep = 0 };
476- LF_INFO (FED , "Policy: Timer Aligned Scheduling join_time: " PRINTF_TIME , joining_time );
477- self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , NEVER_TAG );
478- StartupCoordinator_schedule_startups (self , start_tag );
479- StartupCoordinator_schedule_timers_joining (self , self -> env -> main , start_time , joining_time );
480- self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
481- self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
473+ joining_time = max_logical_time + MSEC (50 );
474+ tag_t start_tag = {.time = joining_time , .microstep = 0 };
475+ LF_INFO (FED , "Policy: Timer Aligned Scheduling join_time: " PRINTF_TIME , joining_time );
476+ self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , NEVER_TAG );
477+ StartupCoordinator_schedule_startups (self , start_tag );
478+ StartupCoordinator_schedule_timers_joining (self , self -> env -> main , start_time , joining_time );
479+ self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
480+ self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
482481 } else {
483482 validate (false);
484483 }
@@ -516,9 +515,8 @@ static void StartupCoordinator_handle_system_event(SystemEventHandler *_self, Sy
516515
517516 case StartupCoordination_joining_time_announcement_tag :
518517 LF_INFO (FED , "Handle: Announcement of Joining Tag" );
519- //TODO: here we then need to set the last message tag on all input ports connected to this transient federate
518+ // TODO: here we then need to set the last message tag on all input ports connected to this transient federate
520519 break ;
521-
522520 }
523521
524522 _self -> payload_pool .free (& _self -> payload_pool , event -> super .payload );
0 commit comments