From 841f38fac0c2a3e759a76c6c5e5962ef5807ecb9 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 20 Oct 2017 15:21:44 +0100 Subject: [PATCH] Starting to save eNB context --- srsepc/hdr/mme/s1ap.h | 2 +- srsepc/src/mme/s1ap.cc | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 6052ba3a1..4280cf622 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -74,7 +74,7 @@ private: srslte::log *m_s1ap_log; int m_s1mme; - std::map m_active_enbs; + std::map m_active_enbs; s1ap_mngmt_proc m_s1ap_mngmt_proc; }; diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 51e7412cd..91ececbc7 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -59,6 +59,13 @@ s1ap::stop() if (m_s1mme != -1){ close(m_s1mme); } + std::map::iterator it = m_active_enbs.begin(); + while(it!=m_active_enbs.end()) + { + print_enb_ctx_info(*it->second); + delete it->second; + m_active_enbs.erase(it++); + } return; } @@ -184,18 +191,21 @@ s1ap::handle_s1_setup_request(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, st m_s1ap_mngmt_proc.pack_s1_setup_failure(LIBLTE_S1AP_CAUSEMISC_UNKNOWN_PLMN,&reply_msg); } else{ - /* - if(m_active_enbs.find(enb_ctx.enb_id)) + std::map::iterator it = m_active_enbs.find(enb_ctx.enb_id); + if(it != m_active_enbs.end()) { //eNB already registered + //TODO replace enb_ctx } else { //new eNB - + enb_ctx_t *enb_ptr = new enb_ctx_t;//TODO use buffer pool here? + memcpy(enb_ptr,&enb_ctx,sizeof(enb_ctx)); + m_active_enbs.insert(std::pair(enb_ptr->enb_id,enb_ptr)); } - */ - m_active_enbs.insert(std::pair(enb_ctx.enb_id,enb_ctx)); + + //m_active_enbs.insert(std::pair(enb_ctx.enb_id,enb_ctx)); m_s1ap_mngmt_proc.pack_s1_setup_response(m_s1ap_args, &reply_msg); m_s1ap_log->console("S1 Setup Response\n"); m_s1ap_log->info("S1 Setup Response\n");