From 35e8b1ca76029616fd7178c5100fae34777b74fc Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 25 Apr 2018 13:07:27 +0200 Subject: [PATCH] Attach only once from main --- srsue/src/main.cc | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/srsue/src/main.cc b/srsue/src/main.cc index dd03541f8..afb7a1f8b 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -474,29 +474,23 @@ int main(int argc, char *argv[]) pthread_t input; pthread_create(&input, NULL, &input_loop, &args); - bool plot_started = false; - bool signals_pregenerated = false; - - while (running) { - if (ue->is_attached()) { - if (!signals_pregenerated && args.expert.pregenerate_signals) { - ue->pregenerate_signals(true); - signals_pregenerated = true; - } - if (!plot_started && args.gui.enable) { - ue->start_plot(); - plot_started = true; - } - } else { - while (!ue->attach() && running) { - sleep(1); - } + printf("Attaching UE...\n"); + while (!ue->attach() && running) { + sleep(1); + printf("Could not attach. Trying again...\n"); + } + if (running) { + if (args.expert.pregenerate_signals) { + ue->pregenerate_signals(true); } - if (running) { - ue->print_pool(); - sleep(10); + if (args.gui.enable) { + ue->start_plot(); } } + while (running) { + ue->print_pool(); + sleep(10); + } pthread_cancel(input); metricshub.stop(); ue->stop();