Always exit and don't try to recover

The current code tries to recover from dropped connections and resets the
pcu state so it can keep running. However, this never worked correctly
which is why the -e option is used. This option exits the pcu as soon as
the internal state needs to be reset.

This patch removes this option and makes this behaviour default.

Ticket: SYS#390
Sponsored-by: On-Waves ehf
This commit is contained in:
Daniel Willmann 2014-06-04 18:30:59 +02:00 committed by Holger Hans Peter Freyther
parent 77e58f602d
commit 6d8884de49
6 changed files with 10 additions and 26 deletions

View File

@ -533,13 +533,8 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
return &the_pcu;
}
void gprs_bssgp_destroy_or_exit(void)
void gprs_bssgp_destroy(void)
{
if (the_pcu.exit_on_destroy) {
LOGP(DBSSGP, LOGL_NOTICE, "Exiting on BSSGP destruction.\n");
exit(0);
}
if (!bssgp_nsi)
return;
@ -564,12 +559,6 @@ void gprs_bssgp_destroy_or_exit(void)
bssgp_nsi = NULL;
}
void gprs_bssgp_exit_on_destroy(void)
{
LOGP(DBSSGP, LOGL_NOTICE, "Going to quit on BSSGP destruction\n");
the_pcu.exit_on_destroy = 1;
}
struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void)
{
return the_pcu.bctx;

View File

@ -57,7 +57,6 @@ struct gprs_bssgp_pcu {
int bvc_sig_reset;
int bvc_reset;
int bvc_unblocked;
int exit_on_destroy;
/** callbacks below */
@ -75,8 +74,7 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
uint16_t nsvci, uint16_t bvci, uint16_t mcc, uint16_t mnc,
uint16_t lac, uint16_t rac, uint16_t cell_id);
void gprs_bssgp_exit_on_destroy(void);
void gprs_bssgp_destroy_or_exit(void);
void gprs_bssgp_destroy(void);
struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void);

View File

@ -179,8 +179,10 @@ int pcu_l1if_open()
void pcu_l1if_close(void)
{
gprs_bssgp_destroy_or_exit();
gprs_bssgp_destroy();
/* FIXME: cleanup l1if */
talloc_free(l1fh->fl1h);
exit(0);
}

View File

@ -324,8 +324,8 @@ bssgp_failed:
for (ts = 0; ts < 8; ts++)
bts->trx[trx].pdch[ts].free_resources();
}
gprs_bssgp_destroy_or_exit();
return 0;
gprs_bssgp_destroy();
exit(0);
}
LOGP(DL1IF, LOGL_INFO, "BTS available\n");
LOGP(DL1IF, LOGL_DEBUG, " mcc=%x\n", info_ind->mcc);

View File

@ -56,7 +56,6 @@ static void print_help()
"provided by BTS\n"
" -r --realtime PRIO Use SCHED_RR with the specified "
"priority\n"
" -e --exit Exit the application on disconnect\n"
);
}
@ -105,7 +104,7 @@ static void handle_options(int argc, char **argv)
rt_prio = atoi(optarg);
break;
case 'e':
gprs_bssgp_exit_on_destroy();
fprintf(stderr, "Warning: Option '-e' is deprecated!\n");
break;
default:
fprintf(stderr, "Unknown option '%c'\n", c);

View File

@ -112,12 +112,8 @@ static void pcu_sock_close(struct pcu_sock_state *state, int lost)
gprs_rlcmac_tbf::free_all(&bts->trx[trx]);
}
gprs_bssgp_destroy_or_exit();
if (lost) {
state->timer.cb = pcu_sock_timeout;
osmo_timer_schedule(&state->timer, 5, 0);
}
gprs_bssgp_destroy();
exit(0);
}
static int pcu_sock_read(struct osmo_fd *bfd)