forked from acouzens/open5gs
Change initialization sequence
This commit is contained in:
parent
bb67705a66
commit
2d7438313d
|
@ -18,7 +18,7 @@ hss_context_t* hss_self()
|
|||
return &self;
|
||||
}
|
||||
|
||||
int hss_context_init(void)
|
||||
void hss_context_init(void)
|
||||
{
|
||||
ogs_assert(context_initialized == 0);
|
||||
|
||||
|
@ -34,19 +34,15 @@ int hss_context_init(void)
|
|||
ogs_thread_mutex_init(&self.db_lock);
|
||||
|
||||
context_initialized = 1;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int hss_context_final(void)
|
||||
void hss_context_final(void)
|
||||
{
|
||||
ogs_assert(context_initialized == 1);
|
||||
|
||||
ogs_thread_mutex_destroy(&self.db_lock);
|
||||
|
||||
context_initialized = 0;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int hss_context_prepare()
|
||||
|
|
|
@ -36,8 +36,8 @@ typedef struct _hss_context_t {
|
|||
ogs_thread_mutex_t db_lock;
|
||||
} hss_context_t;
|
||||
|
||||
int hss_context_init(void);
|
||||
int hss_context_final(void);
|
||||
void hss_context_init(void);
|
||||
void hss_context_final(void);
|
||||
hss_context_t* hss_self(void);
|
||||
|
||||
int hss_context_parse_config(void);
|
||||
|
|
|
@ -9,8 +9,7 @@ int hss_initialize(void)
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = hss_context_init();
|
||||
if (rv != OGS_OK) return rv;
|
||||
hss_context_init();
|
||||
|
||||
rv = hss_context_parse_config();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
|
|
@ -35,7 +35,7 @@ static OGS_POOL(mme_bearer_pool, mme_bearer_t);
|
|||
|
||||
static int context_initialized = 0;
|
||||
|
||||
int mme_context_init()
|
||||
void mme_context_init()
|
||||
{
|
||||
ogs_assert(context_initialized == 0);
|
||||
|
||||
|
@ -82,11 +82,9 @@ int mme_context_init()
|
|||
self.t3413_value = ogs_time_from_sec(2); /* Paging retry timer: 2 secs */
|
||||
|
||||
context_initialized = 1;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int mme_context_final()
|
||||
void mme_context_final()
|
||||
{
|
||||
ogs_assert(context_initialized == 1);
|
||||
|
||||
|
@ -129,8 +127,6 @@ int mme_context_final()
|
|||
ogs_sock_remove_all_nodes(&self.gtpc_list6);
|
||||
|
||||
context_initialized = 0;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
mme_context_t* mme_self()
|
||||
|
|
|
@ -499,8 +499,8 @@ typedef struct _mme_bearer_t {
|
|||
gtp_xact_t *xact;
|
||||
} mme_bearer_t;
|
||||
|
||||
int mme_context_init(void);
|
||||
int mme_context_final(void);
|
||||
void mme_context_init(void);
|
||||
void mme_context_final(void);
|
||||
mme_context_t *mme_self(void);
|
||||
|
||||
int mme_context_parse_config(void);
|
||||
|
|
|
@ -18,7 +18,10 @@ int mme_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = mme_context_init();
|
||||
mme_context_init();
|
||||
mme_event_init();
|
||||
|
||||
rv = gtp_xact_init(mme_self()->timer_mgr);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = mme_context_parse_config();
|
||||
|
@ -71,9 +74,6 @@ static void mme_main(void *data)
|
|||
ogs_fsm_t mme_sm;
|
||||
int rv;
|
||||
|
||||
mme_event_init();
|
||||
gtp_xact_init(mme_self()->timer_mgr);
|
||||
|
||||
ogs_fsm_create(&mme_sm, mme_state_initial, mme_state_final);
|
||||
ogs_fsm_init(&mme_sm, 0);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ pcrf_context_t* pcrf_self()
|
|||
return &self;
|
||||
}
|
||||
|
||||
int pcrf_context_init(void)
|
||||
void pcrf_context_init(void)
|
||||
{
|
||||
ogs_assert(context_initialized == 0);
|
||||
|
||||
|
@ -37,11 +37,9 @@ int pcrf_context_init(void)
|
|||
self.ip_hash = ogs_hash_make();
|
||||
|
||||
context_initialized = 1;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int pcrf_context_final(void)
|
||||
void pcrf_context_final(void)
|
||||
{
|
||||
ogs_assert(context_initialized == 1);
|
||||
ogs_assert(self.ip_hash);
|
||||
|
@ -51,8 +49,6 @@ int pcrf_context_final(void)
|
|||
ogs_thread_mutex_destroy(&self.db_lock);
|
||||
|
||||
context_initialized = 0;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int pcrf_context_prepare()
|
||||
|
|
|
@ -26,8 +26,8 @@ typedef struct _pcrf_context_t {
|
|||
ogs_thread_mutex_t hash_lock;
|
||||
} pcrf_context_t;
|
||||
|
||||
int pcrf_context_init(void);
|
||||
int pcrf_context_final(void);
|
||||
void pcrf_context_init(void);
|
||||
void pcrf_context_final(void);
|
||||
pcrf_context_t *pcrf_self(void);
|
||||
|
||||
int pcrf_context_parse_config(void);
|
||||
|
|
|
@ -8,8 +8,7 @@ int pcrf_initialize(void)
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = pcrf_context_init();
|
||||
if (rv != OGS_OK) return rv;
|
||||
pcrf_context_init();
|
||||
|
||||
rv = pcrf_context_parse_config();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
|
|
@ -27,7 +27,7 @@ static OGS_POOL(pgw_pf_pool, pgw_pf_t);
|
|||
|
||||
static int context_initiaized = 0;
|
||||
|
||||
int pgw_context_init()
|
||||
void pgw_context_init()
|
||||
{
|
||||
ogs_assert(context_initiaized == 0);
|
||||
|
||||
|
@ -62,11 +62,9 @@ int pgw_context_init()
|
|||
self.sess_hash = ogs_hash_make();
|
||||
|
||||
context_initiaized = 1;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int pgw_context_final()
|
||||
void pgw_context_final()
|
||||
{
|
||||
ogs_assert(context_initiaized == 1);
|
||||
|
||||
|
@ -95,8 +93,6 @@ int pgw_context_final()
|
|||
ogs_sock_remove_all_nodes(&self.gtpu_list6);
|
||||
|
||||
context_initiaized = 0;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
pgw_context_t* pgw_self()
|
||||
|
|
|
@ -193,8 +193,8 @@ ED3(uint8_t spare:2;,
|
|||
pgw_bearer_t *bearer;
|
||||
} pgw_pf_t;
|
||||
|
||||
int pgw_context_init(void);
|
||||
int pgw_context_final(void);
|
||||
void pgw_context_init(void);
|
||||
void pgw_context_final(void);
|
||||
pgw_context_t *pgw_self(void);
|
||||
|
||||
int pgw_context_parse_config(void);
|
||||
|
|
|
@ -16,7 +16,10 @@ int pgw_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = pgw_context_init();
|
||||
pgw_context_init();
|
||||
pgw_event_init();
|
||||
|
||||
rv = gtp_xact_init(pgw_self()->timer_mgr);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = pgw_context_parse_config();
|
||||
|
@ -61,9 +64,6 @@ static void pgw_main(void *data)
|
|||
ogs_fsm_t pgw_sm;
|
||||
int rv;
|
||||
|
||||
pgw_event_init();
|
||||
gtp_xact_init(pgw_self()->timer_mgr);
|
||||
|
||||
ogs_fsm_create(&pgw_sm, pgw_state_initial, pgw_state_final);
|
||||
ogs_fsm_init(&pgw_sm, 0);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static OGS_POOL(sgw_tunnel_pool, sgw_tunnel_t);
|
|||
|
||||
static int context_initialized = 0;
|
||||
|
||||
int sgw_context_init()
|
||||
void sgw_context_init()
|
||||
{
|
||||
ogs_assert(context_initialized == 0);
|
||||
|
||||
|
@ -48,11 +48,9 @@ int sgw_context_init()
|
|||
self.imsi_ue_hash = ogs_hash_make();
|
||||
|
||||
context_initialized = 1;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int sgw_context_final()
|
||||
void sgw_context_final()
|
||||
{
|
||||
ogs_assert(context_initialized == 1);
|
||||
|
||||
|
@ -78,8 +76,6 @@ int sgw_context_final()
|
|||
ogs_sock_remove_all_nodes(&self.gtpu_list6);
|
||||
|
||||
context_initialized = 0;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
sgw_context_t* sgw_self()
|
||||
|
|
|
@ -129,8 +129,8 @@ typedef struct _sgw_tunnel_t {
|
|||
gtp_node_t *gnode;
|
||||
} sgw_tunnel_t;
|
||||
|
||||
int sgw_context_init(void);
|
||||
int sgw_context_final(void);
|
||||
void sgw_context_init(void);
|
||||
void sgw_context_final(void);
|
||||
sgw_context_t* sgw_self(void);
|
||||
|
||||
int sgw_context_parse_config(void);
|
||||
|
|
|
@ -14,7 +14,10 @@ int sgw_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
rv = sgw_context_init();
|
||||
sgw_context_init();
|
||||
sgw_event_init();
|
||||
|
||||
rv = gtp_xact_init(sgw_self()->timer_mgr);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = sgw_context_parse_config();
|
||||
|
@ -51,9 +54,6 @@ static void sgw_main(void *data)
|
|||
ogs_fsm_t sgw_sm;
|
||||
int rv;
|
||||
|
||||
sgw_event_init();
|
||||
gtp_xact_init(sgw_self()->timer_mgr);
|
||||
|
||||
ogs_fsm_create(&sgw_sm, sgw_state_initial, sgw_state_final);
|
||||
ogs_fsm_init(&sgw_sm, 0);
|
||||
|
||||
|
|
|
@ -74,12 +74,8 @@ int test_initialize(app_param_t *param, int argc, const char *const argv[])
|
|||
ogs_error("app_will_initialize() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = mme_context_init();
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
ogs_error("mme_context_init() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
mme_context_init();
|
||||
app_did_initialize();
|
||||
|
||||
return rv;
|
||||
|
|
Loading…
Reference in New Issue