Use callback to establish connection before sending PDUs in TestmodeB

master
Daniel Willmann 5 years ago committed by Andre Puschmann
parent 9aa441f8b6
commit 31f1516d74

@ -72,7 +72,7 @@ public:
void stop() final; void stop() final;
bool get_metrics(stack_metrics_t* metrics) final; bool get_metrics(stack_metrics_t* metrics) final;
bool is_rrc_connected(); bool is_rrc_connected() { return rrc.is_connected(); };
// RRC interface for PHY // RRC interface for PHY
void in_sync() final; void in_sync() final;

@ -70,6 +70,8 @@ public:
void timer_expired(uint32_t timeout_id); void timer_expired(uint32_t timeout_id);
void send_queued_data();
void loop_back_pdu_with_tft(uint32_t input_lcid, srslte::unique_byte_buffer_t pdu); void loop_back_pdu_with_tft(uint32_t input_lcid, srslte::unique_byte_buffer_t pdu);
private: private:

@ -226,13 +226,26 @@ void ttcn3_ue::timer_expired(uint32_t timeout_id)
{ {
if (timeout_id == pdu_delay_timer.id()) { if (timeout_id == pdu_delay_timer.id()) {
log.info("Testmode B PDU delay timer expired\n"); log.info("Testmode B PDU delay timer expired\n");
for (auto& bearer_pdu_queue : pdu_queue) { send_queued_data();
log.info("Delivering %zd buffered PDUs for LCID=%d\n", bearer_pdu_queue.second.size(), bearer_pdu_queue.first); }
while (not bearer_pdu_queue.second.empty()) { }
srslte::unique_byte_buffer_t pdu; void ttcn3_ue::send_queued_data()
bearer_pdu_queue.second.try_pop(&pdu); {
loop_back_pdu_with_tft(bearer_pdu_queue.first, std::move(pdu)); if (!stack->is_rrc_connected()) {
} log.info("RRC not connected, requesting NAS attach\n");
if (not stack->switch_on()) {
log.warning("Could not reestablish the connection\n");
}
stack->defer_callback(500, [&]() { send_queued_data(); });
return;
}
for (auto& bearer_pdu_queue : pdu_queue) {
log.info("Delivering %zd buffered PDUs for LCID=%d\n", bearer_pdu_queue.second.size(), bearer_pdu_queue.first);
while (not bearer_pdu_queue.second.empty()) {
srslte::unique_byte_buffer_t pdu;
bearer_pdu_queue.second.try_pop(&pdu);
loop_back_pdu_with_tft(bearer_pdu_queue.first, std::move(pdu));
} }
} }
} }

Loading…
Cancel
Save