From 92a6d8ec66af064cfe356bce1b18e96f5846f1d5 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 9 May 2022 14:30:37 +0100 Subject: [PATCH] lib,rlc_um_nr: fix issue with discard in RLC UM NR --- lib/src/rlc/rlc_um_nr.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/rlc/rlc_um_nr.cc b/lib/src/rlc/rlc_um_nr.cc index 804a95ea4..d0ea8f3bf 100644 --- a/lib/src/rlc/rlc_um_nr.cc +++ b/lib/src/rlc/rlc_um_nr.cc @@ -81,7 +81,7 @@ uint32_t rlc_um_nr::rlc_um_nr_tx::get_buffer_state() std::lock_guard lock(mutex); // Bytes needed for tx SDUs - uint32_t n_sdus = tx_sdu_queue.size(); + uint32_t n_sdus = tx_sdu_queue.get_n_sdus(); uint32_t n_bytes = tx_sdu_queue.size_bytes(); if (tx_sdu) { n_sdus++; @@ -101,7 +101,6 @@ uint32_t rlc_um_nr::rlc_um_nr_tx::get_buffer_state() if (bsr_callback) { bsr_callback(parent->get_lcid(), n_bytes, 0); } - return n_bytes; } @@ -147,7 +146,12 @@ uint32_t rlc_um_nr::rlc_um_nr_tx::build_data_pdu(unique_byte_buffer_t pdu, uint8 // Select segmentation information and header size if (tx_sdu == nullptr) { // Read a new SDU - tx_sdu = tx_sdu_queue.read(); + do { + tx_sdu = tx_sdu_queue.read(); + } while (tx_sdu == nullptr && tx_sdu_queue.size() != 0); + if (tx_sdu == nullptr) { + return 0; + } next_so = 0; // Check for full SDU case