Added cleanup functionality to the hss.

master
Pedro Alvarez 7 years ago
parent a4e1707835
commit a8f268c55b

@ -67,6 +67,8 @@ public:
static hss* get_instance(void); static hss* get_instance(void);
static void cleanup(void); static void cleanup(void);
int init(hss_args_t *hss_args, srslte::log_filter* hss_log); int init(hss_args_t *hss_args, srslte::log_filter* hss_log);
void stop(void);
bool set_auth_algo(std::string auth_algo); bool set_auth_algo(std::string auth_algo);
bool read_db_file(std::string db_file); bool read_db_file(std::string db_file);

@ -48,10 +48,6 @@ hss::hss()
hss::~hss() hss::~hss()
{ {
if(m_db_file.is_open())
{
m_db_file.close();
}
return; return;
} }
@ -98,6 +94,25 @@ hss::init(hss_args_t *hss_args, srslte::log_filter *hss_log)
return 0; return 0;
} }
void
hss::stop(void)
{
std::map<uint64_t,hss_ue_ctx_t*>::iterator it = m_imsi_to_ue_ctx.begin();
while(it!=m_imsi_to_ue_ctx.end())
{
m_hss_log->info("Deleting UE context in HSS. IMSI: %lu\n", it->second->imsi);
m_hss_log->console("Deleting UE context in HSS. IMSI: %lu\n", it->second->imsi);
delete it->second;
m_imsi_to_ue_ctx.erase(it++);
}
if(m_db_file.is_open())
{
m_db_file.close();
}
return;
}
bool bool
hss::set_auth_algo(std::string auth_algo) hss::set_auth_algo(std::string auth_algo)
{ {

@ -250,6 +250,8 @@ main (int argc,char * argv[] )
mme->cleanup(); mme->cleanup();
spgw->stop(); spgw->stop();
spgw->cleanup(); spgw->cleanup();
hss->stop();
hss->cleanup();
cout << std::endl <<"--- exiting ---" << endl; cout << std::endl <<"--- exiting ---" << endl;
return 0; return 0;

Loading…
Cancel
Save