diff --git a/srsue/hdr/stack/mac/demux.h b/srsue/hdr/stack/mac/demux.h index 92f4d8541..510e0499c 100644 --- a/srsue/hdr/stack/mac/demux.h +++ b/srsue/hdr/stack/mac/demux.h @@ -47,6 +47,7 @@ public: rlc_interface_mac* rlc, mac_interface_demux* mac, srslte::timer_handler::unique_timer* time_alignment_timer); + void reset(); bool process_pdus(); uint8_t* request_buffer(uint32_t len); @@ -77,14 +78,14 @@ private: srslte::sch_pdu mac_msg; srslte::mch_pdu mch_mac_msg; srslte::sch_pdu pending_mac_msg; - uint8_t mch_lcids[SRSLTE_N_MCH_LCIDS]; + uint8_t mch_lcids[SRSLTE_N_MCH_LCIDS] = {}; void process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes); void process_sch_pdu(srslte::sch_pdu* pdu); void process_mch_pdu(srslte::mch_pdu* pdu); bool process_ce(srslte::sch_subh* subheader); void parse_ta_cmd(srslte::sch_subh* subh); - bool is_uecrid_successful; + bool is_uecrid_successful = false; srslte::timer_handler::unique_timer* time_alignment_timer = nullptr; diff --git a/srsue/src/stack/mac/demux.cc b/srsue/src/stack/mac/demux.cc index b07a94d1f..603dad96e 100644 --- a/srsue/src/stack/mac/demux.cc +++ b/srsue/src/stack/mac/demux.cc @@ -30,16 +30,7 @@ namespace srsue { -demux::demux(log_ref log_h_) : - log_h(log_h_), - mac_msg(20, log_h_), - mch_mac_msg(20, log_h_), - pending_mac_msg(20, log_h_), - rlc(NULL), - is_uecrid_successful(false), - phy_h(nullptr), - time_alignment_timer(nullptr), - mac(nullptr) +demux::demux(log_ref log_h_) : log_h(log_h_), mac_msg(20, log_h_), mch_mac_msg(20, log_h_), pending_mac_msg(20, log_h_) {} void demux::init(phy_interface_mac_common* phy_, @@ -52,7 +43,12 @@ void demux::init(phy_interface_mac_common* phy_, mac = mac_; time_alignment_timer = time_alignment_timer_; pdus.init(this, log_h); - bzero(&mch_lcids, SRSLTE_N_MCH_LCIDS); +} + +void demux::reset() +{ + // flush all buffered PDUs + pdus.reset(); } bool demux::get_uecrid_successful() diff --git a/srsue/src/stack/mac/mac.cc b/srsue/src/stack/mac/mac.cc index b1f5dfc16..bfd597c2b 100644 --- a/srsue/src/stack/mac/mac.cc +++ b/srsue/src/stack/mac/mac.cc @@ -167,6 +167,8 @@ void mac::reset() mux_unit.msg3_flush(); mux_unit.reset(); + demux_unit.reset(); + ra_procedure.reset(); sr_procedure.reset(); bsr_procedure.reset();