@@ -57,33 +57,6 @@ static lf_ret_t StartupCoordinator_connect_to_neighbors_blocking(StartupCoordina
5757 return LF_OK ;
5858}
5959
60- void StartupCoordinator_schedule_startups (const StartupCoordinator * self , const tag_t start_tag ) {
61- if (self -> env -> startup ) {
62- LF_DEBUG (FED , "Scheduling Startup Reactions at" PRINTF_TAG , start_tag );
63- Event event = EVENT_INIT (start_tag , & self -> env -> startup -> super , NULL );
64- LF_INFO (FED , "Self: %p Scheduler: %p" , self , self -> env -> scheduler );
65- lf_ret_t ret = self -> env -> scheduler -> schedule_at (self -> env -> scheduler , & event );
66- validate (ret == LF_OK );
67- }
68- }
69-
70- void StartupCoordinator_schedule_timers (StartupCoordinator * self , const Reactor * reactor , const tag_t start_tag ) {
71- lf_ret_t ret ;
72- for (size_t i = 0 ; i < reactor -> triggers_size ; i ++ ) {
73- Trigger * trigger = reactor -> triggers [i ];
74- if (trigger -> type == TRIG_TIMER ) {
75- Timer * timer = (Timer * )trigger ;
76- tag_t tag = {.time = start_tag .time + timer -> offset , .microstep = start_tag .microstep };
77- Event event = EVENT_INIT (tag , trigger , NULL );
78- ret = self -> env -> scheduler -> schedule_at (self -> env -> scheduler , & event );
79- validate (ret == LF_OK );
80- }
81- }
82- for (size_t i = 0 ; i < reactor -> children_size ; i ++ ) {
83- StartupCoordinator_schedule_timers (self , reactor -> children [i ], start_tag );
84- }
85- }
86-
8760void StartupCoordinator_schedule_timers_joining (StartupCoordinator * self , Reactor * reactor ,
8861 interval_t federation_start_time , interval_t join_time ) {
8962 lf_ret_t ret ;
@@ -368,8 +341,8 @@ static void StartupCoordinator_handle_start_time_proposal(StartupCoordinator *se
368341 self -> state = StartupCoordinationState_RUNNING ;
369342 self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , self -> start_time_proposal );
370343 tag_t start_tag = {.time = self -> start_time_proposal , .microstep = 0 };
371- StartupCoordinator_schedule_startups (self , start_tag );
372- StartupCoordinator_schedule_timers (self , self -> env -> main , start_tag );
344+ Environment_schedule_startups (self -> env , start_tag );
345+ Environment_schedule_timers (self -> env , self -> env -> main , start_tag );
373346 } else {
374347 self -> start_time_proposal_step ++ ;
375348 send_start_time_proposal (self , self -> start_time_proposal , self -> start_time_proposal_step );
@@ -465,16 +438,16 @@ static void StartupCoordinator_handle_start_time_response(StartupCoordinator *se
465438 tag_t start_tag = {.time = joining_time , .microstep = 0 };
466439 LF_INFO (FED , "Policy: IMMEDIATELY Scheduling join_time: " PRINTF_TIME , joining_time );
467440 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 );
441+ Environment_schedule_startups (self -> env , start_tag );
442+ Environment_schedule_timers (self -> env , self -> env -> main , start_tag );
470443 self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
471444 self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
472445 } else if (self -> joining_policy == JOIN_ALIGNED_WITH_SHORT_TIMER ) {
473446 joining_time = max_logical_time + MSEC (50 );
474447 tag_t start_tag = {.time = joining_time , .microstep = 0 };
475448 LF_INFO (FED , "Policy: Timer Aligned Scheduling join_time: " PRINTF_TIME , joining_time );
476449 self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , NEVER_TAG );
477- StartupCoordinator_schedule_startups (self , start_tag );
450+ Environment_schedule_startups (self -> env , start_tag );
478451 StartupCoordinator_schedule_timers_joining (self , self -> env -> main , start_time , joining_time );
479452 self -> env -> scheduler -> prepare_timestep (self -> env -> scheduler , start_tag );
480453 self -> env -> scheduler -> set_and_schedule_start_tag (self -> env -> scheduler , joining_time );
@@ -542,6 +515,8 @@ void StartupCoordinator_ctor(StartupCoordinator *self, Environment *env, Neighbo
542515 self -> start_time_proposal = NEVER ;
543516 self -> joining_policy = joining_policy ;
544517 for (size_t i = 0 ; i < self -> num_neighbours ; i ++ ) {
518+ self -> neighbor_state [i ].core_federate = true;
519+ self -> neighbor_state [i ].current_logical_time = 0 ;
545520 self -> neighbor_state [i ].handshake_response_received = false;
546521 self -> neighbor_state [i ].handshake_request_received = false;
547522 self -> neighbor_state [i ].handshake_response_sent = false;
0 commit comments