a_reset: Add additional "a_reset_alloc" argument
Using this argument we can create the state machine in the "already connected" state, i.e. without starting an outbound RESET procedure. Change-Id: Ibf569d57300965cd47084fa0bff54aa67679e2a1
This commit is contained in:
parent
66a301e65d
commit
b6777fb055
|
@ -45,7 +45,8 @@ struct a_reset_ctx {
|
|||
};
|
||||
|
||||
/* Create and start state machine which handles the reset/reset-ack procedure */
|
||||
struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv);
|
||||
struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv,
|
||||
bool already_connected);
|
||||
|
||||
/* Tear down state machine */
|
||||
void a_reset_free(struct a_reset_ctx *reset);
|
||||
|
|
|
@ -114,7 +114,8 @@ static struct osmo_fsm fsm = {
|
|||
};
|
||||
|
||||
/* Create and start state machine which handles the reset/reset-ack procedure */
|
||||
struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv)
|
||||
struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv,
|
||||
bool already_connected)
|
||||
{
|
||||
OSMO_ASSERT(name);
|
||||
|
||||
|
@ -134,8 +135,13 @@ struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, v
|
|||
OSMO_ASSERT(reset->fsm);
|
||||
reset->fsm->priv = reset;
|
||||
|
||||
/* kick off reset-ack sending mechanism */
|
||||
osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
|
||||
if (already_connected)
|
||||
osmo_fsm_inst_state_chg(reset->fsm, ST_CONN, 0, 0);
|
||||
else {
|
||||
/* kick off reset-ack sending mechanism */
|
||||
osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL,
|
||||
RESET_RESEND_TIMER_NO);
|
||||
}
|
||||
|
||||
return reset;
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ static void add_bsc(const struct osmo_sccp_addr *msc_addr, const struct osmo_scc
|
|||
|
||||
/* Start reset procedure to make the new connection active */
|
||||
snprintf(bsc_name, sizeof(bsc_name), "bsc-%i", bsc_addr->pc);
|
||||
bsc_ctx->reset = a_reset_alloc(bsc_ctx, bsc_name, a_reset_cb, bsc_ctx);
|
||||
bsc_ctx->reset = a_reset_alloc(bsc_ctx, bsc_name, a_reset_cb, bsc_ctx, false);
|
||||
}
|
||||
|
||||
/* Callback function, called by the SSCP stack when data arrives */
|
||||
|
|
Loading…
Reference in New Issue