Skip to content

Commit

Permalink
Try erasing the net functions for git history
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Feb 1, 2024
1 parent 219b0cf commit acb4553
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
17 changes: 2 additions & 15 deletions core/federated/RTI/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ int main(int argc, const char* argv[]) {
rti.base.scheduling_nodes[i] = (scheduling_node_t *) fed_info;
}
// TODO: Need to add user_specified_port
if (start_net_rti_server()){
net_wait_for_federates(rti.rti_netdrv);
if (start_rti_server()){
wait_for_federates(rti.rti_netdrv);
normal_termination = true;
if (rti.base.tracing_enabled) {
// No need for a mutex lock because all threads have exited.
Expand All @@ -343,19 +343,6 @@ int main(int argc, const char* argv[]) {
}
}



// int socket_descriptor = start_rti_server(rti.user_specified_port);
// if (socket_descriptor >= 0) {
// wait_for_federates(socket_descriptor);
// normal_termination = true;
// if (rti.base.tracing_enabled) {
// // No need for a mutex lock because all threads have exited.
// stop_trace_locked(rti.base.trace);
// lf_print("RTI trace file saved.");
// }
// }

lf_print("RTI is exiting."); // Do this before freeing scheduling nodes.
free_scheduling_nodes(rti.base.scheduling_nodes, rti.base.number_of_scheduling_nodes);

Expand Down
15 changes: 1 addition & 14 deletions core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ void initialize_federate(federate_info_t *fed, uint16_t id) {
fed->clock_netdrv = netdrv_init();
}

int32_t start_net_rti_server() {
int32_t start_rti_server() {
_lf_initialize_clock();
// Create the RTI's netdriver.
int success = create_net_server(rti_remote->rti_netdrv, RTI);
Expand All @@ -2112,19 +2112,6 @@ int32_t start_net_rti_server() {
return success;
}

int32_t start_rti_server(uint16_t port) {
_lf_initialize_clock();
// Create the TCP socket server
rti_remote->socket_descriptor_TCP = create_rti_server(port, TCP);
lf_print("RTI: Listening for federates.");
// Create the UDP socket server
// Try to get the rti_remote->final_port_TCP + 1 port
if (rti_remote->clock_sync_global_status >= clock_sync_on) {
rti_remote->socket_descriptor_UDP = create_rti_server(rti_remote->final_port_TCP + 1, UDP);
}
return rti_remote->socket_descriptor_TCP;
}

void net_wait_for_federates(netdrv_t *netdrv) {
// Wait for connections from federates and create a thread for each.
net_lf_connect_to_federates(netdrv);
Expand Down

0 comments on commit acb4553

Please sign in to comment.