Delay abis reconnect while bts is shutting down
Avoid re-connecting to a new BSC while BTS is in shutting down. All the FSMs are complex enough to even try to re-start when stopping has not yet finished... Change-Id: I1727828a16f4ec8043b00cc6b2e02a4c35f71377
This commit is contained in:
parent
d17beeacde
commit
1c3431db95
|
@ -39,3 +39,6 @@ enum bts_shutdown_fsm_events {
|
|||
};
|
||||
|
||||
extern struct osmo_fsm bts_shutdown_fsm;
|
||||
|
||||
struct gsm_bts;
|
||||
bool bts_shutdown_in_progress(const struct gsm_bts *bts);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include <osmo-bts/abis_osmo.h>
|
||||
#include <osmo-bts/bts_model.h>
|
||||
#include <osmo-bts/bts_trx.h>
|
||||
#include <osmo-bts/bts_shutdown_fsm.h>
|
||||
|
||||
static struct gsm_bts *g_bts;
|
||||
|
||||
|
@ -137,6 +138,12 @@ static void abis_link_connecting_onenter(struct osmo_fsm_inst *fi, uint32_t prev
|
|||
struct abis_link_fsm_priv *priv = fi->priv;
|
||||
struct gsm_bts *bts = priv->bts;
|
||||
|
||||
if (bts_shutdown_in_progress(bts)) {
|
||||
LOGPFSML(fi, LOGL_NOTICE, "BTS is shutting down, delaying A-bis connection establishment to BSC\n");
|
||||
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pick_next_bsc(fi) < 0) {
|
||||
LOGPFSML(fi, LOGL_FATAL, "No BSC available, A-bis connection establishment failed\n");
|
||||
osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
|
||||
|
|
|
@ -237,10 +237,16 @@ static __attribute__((constructor)) void bts_shutdown_fsm_init(void)
|
|||
OSMO_ASSERT(osmo_fsm_register(&bts_shutdown_fsm) == 0);
|
||||
}
|
||||
|
||||
bool bts_shutdown_in_progress(const struct gsm_bts *bts)
|
||||
{
|
||||
const struct osmo_fsm_inst *fi = bts->shutdown_fi;
|
||||
return fi->state != BTS_SHUTDOWN_ST_NONE;
|
||||
}
|
||||
|
||||
void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
|
||||
{
|
||||
struct osmo_fsm_inst *fi = bts->shutdown_fi;
|
||||
if (fi->state != BTS_SHUTDOWN_ST_NONE) {
|
||||
if (bts_shutdown_in_progress(bts)) {
|
||||
LOGPFSML(fi, LOGL_NOTICE, "BTS is already being shutdown.\n");
|
||||
if (exit_proc)
|
||||
bts->shutdown_fi_exit_proc = true;
|
||||
|
|
Loading…
Reference in New Issue