From ca7c865ce845e0998999c0b0a005855f7ae71b92 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 25 Nov 2019 15:18:21 +0000 Subject: [PATCH] Removed unecessery indentation in RLC AM write SDU. --- lib/src/upper/rlc_am_lte.cc | 51 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 265fbec2c..84d305006 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -330,36 +330,33 @@ void rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blockin return; } - if (sdu.get() != NULL) { - if (blocking) { - // block on write to queue - log->info_hex(sdu->msg, - sdu->N_bytes, - "%s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", + if (sdu.get() == nullptr) { + log->warning("NULL SDU pointer in write_sdu()\n"); + return; + } + + if (blocking) { + // block on write to queue + log->info_hex( + sdu->msg, sdu->N_bytes, "%s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", RB_NAME, sdu->N_bytes, tx_sdu_queue.size()); + tx_sdu_queue.write(std::move(sdu)); + } else { + // non-blocking write + uint8_t* msg_ptr = sdu->msg; + uint32_t nof_bytes = sdu->N_bytes; + std::pair ret = tx_sdu_queue.try_write(std::move(sdu)); + if (ret.first) { + log->info_hex( + msg_ptr, nof_bytes, "%s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", RB_NAME, nof_bytes, tx_sdu_queue.size()); + } else { + // in case of fail, the try_write returns back the sdu + log->info_hex(ret.second->msg, + ret.second->N_bytes, + "[Dropped SDU] %s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", RB_NAME, - sdu->N_bytes, + ret.second->N_bytes, tx_sdu_queue.size()); - tx_sdu_queue.write(std::move(sdu)); - } else { - // non-blocking write - uint8_t* msg_ptr = sdu->msg; - uint32_t nof_bytes = sdu->N_bytes; - std::pair ret = tx_sdu_queue.try_write(std::move(sdu)); - if (ret.first) { - log->info_hex( - msg_ptr, nof_bytes, "%s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", RB_NAME, nof_bytes, tx_sdu_queue.size()); - } else { - // in case of fail, the try_write returns back the sdu - log->info_hex(ret.second->msg, - ret.second->N_bytes, - "[Dropped SDU] %s Tx SDU (%d B, tx_sdu_queue_len=%d)\n", - RB_NAME, - ret.second->N_bytes, - tx_sdu_queue.size()); - } } - } else { - log->warning("NULL SDU pointer in write_sdu()\n"); } }