Skip to content

Commit

Permalink
Properly close federate's socket connected to the RTI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Dec 21, 2024
1 parent 93adf2e commit d27c743
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/federated/federate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1493,21 +1493,21 @@ static void* listen_to_rti_TCP(void* args) {
lf_print_error("Socket connection to the RTI was closed by the RTI without"
" properly sending an EOF first. Considering this a soft error.");
// FIXME: If this happens, possibly a new RTI must be elected.
_fed.socket_TCP_RTI = -1;
shutdown_socket(_fed.socket_TCP_RTI, false);
return NULL;
} else {
lf_print_error("Socket connection to the RTI has been broken with error %d: %s."
" The RTI should close connections with an EOF first."
" Considering this a soft error.",
errno, strerror(errno));
// FIXME: If this happens, possibly a new RTI must be elected.
_fed.socket_TCP_RTI = -1;
shutdown_socket(_fed.socket_TCP_RTI, false);
return NULL;
}
} else if (read_failed > 0) {
// EOF received.
lf_print("Connection to the RTI closed with an EOF.");
_fed.socket_TCP_RTI = -1;
shutdown_socket(_fed.socket_TCP_RTI, false);
return NULL;
}
switch (buffer[0]) {
Expand Down

0 comments on commit d27c743

Please # to comment.