diff --git a/srsue/hdr/stack/rrc/rrc.h b/srsue/hdr/stack/rrc/rrc.h index 76f0cb2d7..74fd6e168 100644 --- a/srsue/hdr/stack/rrc/rrc.h +++ b/srsue/hdr/stack/rrc/rrc.h @@ -382,7 +382,7 @@ private: srslte::bit_buffer_t bit_buf; - rrc_state_t state, last_state = RRC_STATE_IDLE; + rrc_state_t state = RRC_STATE_IDLE, last_state = RRC_STATE_IDLE; uint8_t transaction_id = 0; srslte::s_tmsi_t ue_identity; bool ue_identity_configured = false; @@ -413,9 +413,9 @@ private: // RRC constants and timers srslte::timers* timers = nullptr; - uint32_t n310_cnt, N310 = 0; - uint32_t n311_cnt, N311 = 0; - uint32_t t300, t301, t302, t310, t311, t304 = 0; + uint32_t n310_cnt = 0, N310 = 0; + uint32_t n311_cnt = 0, N311 = 0; + uint32_t t300 = 0, t301 = 0, t302 = 0, t310 = 0, t311 = 0, t304 = 0; // Radio bearers typedef enum{ diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 30b727eee..8489144f1 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -415,29 +415,29 @@ void rrc::process_new_phy_meas(phy_meas_t meas) // Detection of physical layer problems in RRC_CONNECTED (5.3.11.1) void rrc::out_of_sync() { - // CAUTION: We do not lock in this function since they are called from real-time threads + if (serving_cell && timers && rrc_log) { + serving_cell->in_sync = false; - serving_cell->in_sync = false; - - // upon receiving N310 consecutive "out-of-sync" indications for the PCell from lower layers while neither T300, - // T301, T304 nor T311 is running: - if (state == RRC_STATE_CONNECTED) { - if (!timers->get(t300)->is_running() && !timers->get(t301)->is_running() && !timers->get(t304)->is_running() && - !timers->get(t310)->is_running() && !timers->get(t311)->is_running()) { - rrc_log->info("Received out-of-sync while in state %s. n310=%d, t311=%s, t310=%s\n", - rrc_state_text[state], - n310_cnt, - timers->get(t311)->is_running() ? "running" : "stop", - timers->get(t310)->is_running() ? "running" : "stop"); - n310_cnt++; - if (n310_cnt == N310) { - rrc_log->info("Detected %d out-of-sync from PHY. Trying to resync. Starting T310 timer %d ms\n", - N310, - timers->get(t310)->get_timeout()); - timers->get(t310)->reset(); - timers->get(t310)->run(); - n310_cnt = 0; + // upon receiving N310 consecutive "out-of-sync" indications for the PCell from lower layers while neither T300, + // T301, T304 nor T311 is running: + if (state == RRC_STATE_CONNECTED) { + if (!timers->get(t300)->is_running() && !timers->get(t301)->is_running() && !timers->get(t304)->is_running() && + !timers->get(t310)->is_running() && !timers->get(t311)->is_running()) { + rrc_log->info("Received out-of-sync while in state %s. n310=%d, t311=%s, t310=%s\n", + rrc_state_text[state], + n310_cnt, + timers->get(t311)->is_running() ? "running" : "stop", + timers->get(t310)->is_running() ? "running" : "stop"); + n310_cnt++; + if (n310_cnt == N310) { + rrc_log->info("Detected %d out-of-sync from PHY. Trying to resync. Starting T310 timer %d ms\n", + N310, + timers->get(t310)->get_timeout()); + timers->get(t310)->reset(); + timers->get(t310)->run(); + n310_cnt = 0; + } } } }