Make osmo-pcu wait for BTS to become available at start-up time.
After the PCU socket becomes available, the BTS might send an
INFO_IND message with the 'ACTIVE' flag cleared. If this happens,
do not exit immediately, but keep retrying until an INFO_IND
message with the 'ACTIVE' flag arrives.
Note that this change only affects behaviour at process start-up time.
If the BTS switches from active to inactive state then osmo-pcu will
still exit. If this behaviour should be changed as well it could be
done in a follow-up patch.
Tested against osom-bsc + osmo-bts-virtual.
Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309
Related: OS#2689
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 7112b04..0a9803b 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -414,7 +414,10 @@
if (!(info_ind->flags & PCU_IF_FLAG_ACTIVE)) {
LOGP(DL1IF, LOGL_NOTICE, "BTS not available\n");
+ if (!bts->active)
+ return -EAGAIN;
bssgp_failed:
+ bts->active = false;
/* free all TBF */
for (trx = 0; trx < ARRAY_SIZE(bts->trx); trx++) {
bts->trx[trx].arfcn = info_ind->trx[trx].arfcn;
@@ -562,6 +565,7 @@
}
}
+ bts->active = true;
return rc;
}