Skip to content

Commit

Permalink
Fix MSG_TYPE_NEIGHBOR_STRUCTURE to write() twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Feb 6, 2025
1 parent 7256030 commit 315538d
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,19 @@ public static String generateFederateNeighborStructure(FederateInstance federate
"encode_int32((int32_t)"
+ federate.sendsTo.keySet().size()
+ ", &(buffer_to_send[message_head]));",
"message_head+=sizeof(int32_t);"));
"message_head+=sizeof(int32_t);",
"size_t header_size = message_head;"));
code.pr(
String.join(
"\n",
"// Send the encoded neighbor structure header message to the RTI",
"write_to_netdrv_fail_on_error(",
" rti_netdrv,",
" header_size,",
" buffer_to_send,",
" NULL,",
" \"Failed to send the neighbor structure header message to the RTI.\"",
");"));

if (!federate.dependsOn.keySet().isEmpty()) {
// Next, populate these arrays.
Expand Down Expand Up @@ -451,8 +463,8 @@ public static String generateFederateNeighborStructure(FederateInstance federate
"\n",
"write_to_netdrv_fail_on_error(",
" rti_netdrv, ",
" buffer_size,",
" buffer_to_send,",
" buffer_size - header_size,",
" buffer_to_send + header_size,",
" NULL,",
" \"Failed to send the neighbor structure message to the RTI.\"",
");"));
Expand Down

0 comments on commit 315538d

Please sign in to comment.