From ea0a413c8abab8b00fb15d039da7418099c32ba0 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 17 Oct 2019 14:49:16 +0100 Subject: [PATCH] Added check on wether the PDCP entity is initialized. --- lib/include/srslte/upper/pdcp_entity_nr.h | 2 ++ lib/src/upper/pdcp_entity_nr.cc | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index f465f6d86..335ad09f3 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -68,6 +68,8 @@ public: void set_rx_reord(uint32_t rx_reord_) { rx_reord = rx_reord_; } private: + bool initialized = false; + srsue::rlc_interface_pdcp* rlc = nullptr; srsue::rrc_interface_pdcp* rrc = nullptr; srsue::gw_interface_pdcp* gw = nullptr; diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index 3e969cf37..8c270acb3 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -54,6 +54,9 @@ void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_, reordering_timer_id = timers->get_unique_id(); reordering_timer = timers->get(reordering_timer_id); reordering_timer->set(reordering_fnc.get(), (uint32_t)cfg.t_reordering); + + // Mark entity as initialized + initialized = true; } // Reestablishment procedure: 38.323 5.2 @@ -75,6 +78,12 @@ void pdcp_entity_nr::reset() // SDAP/RRC interface void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking) { + // Check initialization + if (not initialized) { + return; + } + + // Log SDU log->info_hex(sdu->msg, sdu->N_bytes, "TX %s SDU, do_integrity = %s, do_encryption = %s", @@ -118,6 +127,12 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking) // RLC interface void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu) { + // Check initialization + if (not initialized) { + return; + } + + // Log PDU log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU (%d B), do_integrity = %s, do_encryption = %s",