Skip to content

Commit

Permalink
Fixed handle_stop_request_reply
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Feb 1, 2024
1 parent 29dec4e commit c89de1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
12 changes: 3 additions & 9 deletions core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,14 +723,8 @@ void handle_stop_request_message(federate_info_t *fed, unsigned char *buffer) {
LF_MUTEX_UNLOCK(rti_mutex);
}

void handle_stop_request_reply(federate_info_t *fed) {
size_t bytes_to_read = MSG_TYPE_STOP_REQUEST_REPLY_LENGTH - 1;
unsigned char buffer_stop_time[bytes_to_read];
read_from_socket_fail_on_error(&fed->socket, bytes_to_read, buffer_stop_time, NULL,
"RTI failed to read the reply to MSG_TYPE_STOP_REQUEST message from federate %d.",
fed->enclave.id);

tag_t federate_stop_tag = extract_tag(buffer_stop_time);
void handle_stop_request_reply(federate_info_t *fed, unsigned char *buffer) {
tag_t federate_stop_tag = extract_tag(buffer);

if (rti_remote->base.tracing_enabled) {
tracepoint_rti_from_federate(rti_remote->base.trace, receive_STOP_REQ_REP, fed->enclave.id, &federate_stop_tag);
Expand Down Expand Up @@ -1207,7 +1201,7 @@ void *federate_info_thread_TCP(void *fed) {
case MSG_TYPE_STOP_REQUEST:
handle_stop_request_message(my_fed, buffer + 1);
case MSG_TYPE_STOP_REQUEST_REPLY:
handle_stop_request_reply(my_fed);
handle_stop_request_reply(my_fed, buffer + 1);
break;
case MSG_TYPE_PORT_ABSENT:
handle_port_absent_message(my_fed, buffer);
Expand Down
2 changes: 1 addition & 1 deletion core/federated/RTI/rti_remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void handle_stop_request_message(federate_info_t *fed, unsigned char *buffer);
*
* @param fed The federate replying the MSG_TYPE_STOP_REQUEST
*/
void handle_stop_request_reply(federate_info_t* fed);
void handle_stop_request_reply(federate_info_t* fed, unsigned char *buffer);

//////////////////////////////////////////////////

Expand Down
6 changes: 3 additions & 3 deletions core/federated/network/lf_socket_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ int read_from_netdrv(netdrv_t* netdrv, unsigned char* buffer) {
case MSG_TYPE_STOP_REQUEST:
net_read_from_socket_fail_on_error(&priv->socket_descriptor, MSG_TYPE_STOP_REQUEST_LENGTH - 1, buffer, NULL,
"RTI failed to read the MSG_TYPE_STOP_REQUEST payload.");
// case MSG_TYPE_STOP_REQUEST_REPLY:
// handle_stop_request_reply(my_fed);
// break;
case MSG_TYPE_STOP_REQUEST_REPLY:
net_read_from_socket_fail_on_error(&priv->socket_descriptor, MSG_TYPE_STOP_REQUEST_REPLY_LENGTH - 1, buffer, NULL,
"RTI failed to read the reply to MSG_TYPE_STOP_REQUEST message.");
// case MSG_TYPE_STOP_GRANTED:
// handle_stop_granted_message();
// break;
Expand Down

0 comments on commit c89de1e

Please sign in to comment.