1111#include "tst_defs.h"
1212
1313static bool async_receive_flag = false;
14- static incoming_queue_item_t * incoming_item = NULL ;
14+ static robusto_message_t * incoming_message = NULL ;
1515
1616static robusto_peer_t * incoming_peer = NULL ;
1717static uint8_t * reply_msg = NULL ;
@@ -141,7 +141,8 @@ void tst_i2c_message_receive_presentation(void)
141141
142142void i2c_tst_do_on_work (incoming_queue_item_t * _incoming_item ) {
143143 ROB_LOGI ("TEST" , "In i2c_tst_do_on_work" );
144- incoming_item = _incoming_item ;
144+ incoming_message = _incoming_item -> message ;
145+ _incoming_item -> recipient_frees_message = true;
145146 async_receive_flag = true;
146147
147148}
@@ -151,19 +152,20 @@ void tst_i2c_message_receive_string_message(void) {
151152 // Register the on work callback
152153 robusto_register_handler (i2c_tst_do_on_work );
153154 async_receive_flag = false;
154- incoming_item = NULL ;
155+ incoming_message = NULL ;
155156
156157 if (robusto_waitfor_bool (& async_receive_flag , 30000 )) {
157158 ROB_LOGI ("Test" , "Async receive flag was set to true." );
158159 } else {
159160 TEST_FAIL_MESSAGE ("Test failed, timed out." );
160161 }
161- if (incoming_item == NULL ) {
162+ if (incoming_message == NULL ) {
162163 TEST_FAIL_MESSAGE ("Test failed, incoming_item NULL." );
163164 }
164- TEST_ASSERT_EQUAL_INT_MESSAGE (2 , incoming_item -> message -> string_count , "The string count is wrong." );
165- TEST_ASSERT_EQUAL_STRING_MESSAGE (& tst_strings , incoming_item -> message -> strings [0 ], "First string did not match" );
166- TEST_ASSERT_EQUAL_STRING_MESSAGE ((char * )& (tst_strings [4 ]), incoming_item -> message -> strings [1 ], "Second string did not match" );
165+ TEST_ASSERT_EQUAL_INT_MESSAGE (2 , incoming_message -> string_count , "The string count is wrong." );
166+ TEST_ASSERT_EQUAL_STRING_MESSAGE (& tst_strings , incoming_message -> strings [0 ], "First string did not match" );
167+ TEST_ASSERT_EQUAL_STRING_MESSAGE ((char * )& (tst_strings [4 ]), incoming_message -> strings [1 ], "Second string did not match" );
168+ robusto_message_free (incoming_message );
167169
168170
169171}
0 commit comments