Skip to content

Commit

Permalink
Revert "Merge pull request #368 from lf-lang/tagged_message_type"
Browse files Browse the repository at this point in the history
This reverts commit ec3b6de, reversing
changes made to 5e92613.
  • Loading branch information
lhstrh committed Feb 28, 2024
1 parent 21156b9 commit 0322744
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/federated/RTI/rti_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void handle_port_absent_message(federate_info_t *sending_federate, unsigned char
}

void handle_timed_message(federate_info_t *sending_federate, unsigned char *buffer) {
size_t header_size = 1 + sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t)
size_t header_size = 1 + sizeof(uint16_t) + sizeof(uint16_t) + sizeof(int32_t)
+ sizeof(int64_t) + sizeof(uint32_t);
// Read the header, minus the first byte which has already been read.
read_from_socket_fail_on_error(
Expand Down
4 changes: 2 additions & 2 deletions core/federated/federate.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static int handle_tagged_message(int* socket, int fed_id) {
_lf_get_environments(&env);

// Read the header which contains the timestamp.
size_t bytes_to_read = sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t)
size_t bytes_to_read = sizeof(uint16_t) + sizeof(uint16_t) + sizeof(int32_t)
+ sizeof(instant_t) + sizeof(microstep_t);
unsigned char buffer[bytes_to_read];
if (read_from_socket_close_on_error(socket, bytes_to_read, buffer)) {
Expand Down Expand Up @@ -2653,7 +2653,7 @@ int lf_send_tagged_message(environment_t* env,
buffer_head += sizeof(uint16_t);

// The next four bytes are the message length.
encode_uint32((uint32_t)length, &(header_buffer[buffer_head]));
encode_int32((int32_t)length, &(header_buffer[buffer_head]));
buffer_head += sizeof(int32_t);

// Apply the additional delay to the current tag and use that as the intended
Expand Down
2 changes: 1 addition & 1 deletion core/federated/network/net_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void extract_header(
// printf("DEBUG: Message for port %d of federate %d.\n", *port_id, *federate_id);

// The next four bytes are the message length.
uint32_t local_length_signed = extract_uint32(&(buffer[sizeof(uint16_t) + sizeof(uint16_t)]));
int32_t local_length_signed = extract_int32(&(buffer[sizeof(uint16_t) + sizeof(uint16_t)]));
if (local_length_signed < 0) {
lf_print_error_and_exit(
"Received an invalid message length (%d) from federate %d.",
Expand Down
2 changes: 1 addition & 1 deletion include/core/federated/network/net_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Byte identifying a timestamped message to forward to another federate.
* The next two bytes will be the ID of the destination reactor port.
* The next two bytes are the destination federate ID.
* The four bytes after that will be the length of the message (as an unsigned 32-bit int).
* The four bytes after that will be the length of the message.
* The next eight bytes will be the timestamp of the message.
* The next four bytes will be the microstep of the message.
* The remaining bytes are the message.
Expand Down

0 comments on commit 0322744

Please sign in to comment.