@@ -103,6 +103,7 @@ class SessionTest : public testing::Test
103103 uint8_t input_reliable_buffer[MTU * HISTORY ];
104104
105105 static int listening_counter;
106+ static int sending_counter;
106107
107108 static bool send_msg (
108109 void * instance,
@@ -124,6 +125,13 @@ class SessionTest : public testing::Test
124125 EXPECT_EQ (size_t (MTU ), len);
125126 return false ;
126127 }
128+ else if (std::string (" FlashReliableStreamSendError" ) ==
129+ ::testing::UnitTest::GetInstance ()->current_test_info()->name())
130+ {
131+ EXPECT_EQ (size_t (OFFSET + SUBHEADER_SIZE + 8 ), len);
132+ SessionTest::sending_counter++;
133+ return false ;
134+ }
127135 else if (std::string (" SendHeartbeat" ) == ::testing::UnitTest::GetInstance ()->current_test_info ()->name ())
128136 {
129137 EXPECT_EQ (size_t (HEARTBEAT_MAX_MSG_SIZE - (MAX_HEADER_SIZE - OFFSET )), len);
@@ -272,6 +280,7 @@ class SessionTest : public testing::Test
272280
273281SessionTest* SessionTest::current = nullptr ;
274282int SessionTest::listening_counter;
283+ int SessionTest::sending_counter;
275284
276285TEST_F (SessionTest, SetStatusCallback)
277286{
@@ -355,6 +364,28 @@ TEST_F(SessionTest, FlashStreams)
355364 uxr_flash_output_streams (&session);
356365}
357366
367+ TEST_F (SessionTest, FlashReliableStreamSendError)
368+ {
369+ SessionTest::sending_counter = 0 ;
370+
371+ ucdrBuffer ub;
372+ uxrStreamId output_reliable = uxr_stream_id (0 , UXR_RELIABLE_STREAM , UXR_OUTPUT_STREAM );
373+ (void ) uxr_prepare_stream_to_write_submessage (&session, output_reliable, 8 , &ub, 1 , 0 );
374+
375+ uxrOutputReliableStream* stream = &session.streams .output_reliable [0 ];
376+ uxr_flash_output_streams (&session);
377+
378+ EXPECT_EQ (1 , SessionTest::sending_counter);
379+ EXPECT_EQ (SEQ_NUM_MAX , stream->last_sent );
380+ EXPECT_EQ (0u , stream->last_written );
381+
382+ uxr_flash_output_streams (&session);
383+
384+ EXPECT_EQ (2 , SessionTest::sending_counter);
385+ EXPECT_EQ (SEQ_NUM_MAX , stream->last_sent );
386+ EXPECT_EQ (0u , stream->last_written );
387+ }
388+
358389TEST_F (SessionTest, WaitSessionStatusBad)
359390{
360391 // The OK version is already checked with the CreateOk and DeleteOk test versions
0 commit comments