Commit 2645bad3 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for deadlock when removing gNB context

parent 3b2bda13
...@@ -144,6 +144,7 @@ void ngap_app::set_assoc_id_2_gnb_context( ...@@ -144,6 +144,7 @@ void ngap_app::set_assoc_id_2_gnb_context(
const sctp_assoc_id_t& assoc_id, std::shared_ptr<gnb_context> gc) { const sctp_assoc_id_t& assoc_id, std::shared_ptr<gnb_context> gc) {
std::shared_lock lock(m_assoc2gnbContext); std::shared_lock lock(m_assoc2gnbContext);
assoc2gnbContext[assoc_id] = gc; assoc2gnbContext[assoc_id] = gc;
return;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -164,10 +165,15 @@ void ngap_app::set_gnb_id_2_gnb_context( ...@@ -164,10 +165,15 @@ void ngap_app::set_gnb_id_2_gnb_context(
const long& gnb_id, std::shared_ptr<gnb_context> gc) { const long& gnb_id, std::shared_ptr<gnb_context> gc) {
std::unique_lock lock(m_gnbid2gnbContext); std::unique_lock lock(m_gnbid2gnbContext);
gnbid2gnbContext[gnb_id] = gc; gnbid2gnbContext[gnb_id] = gc;
return;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ngap_app::remove_gnb_context(const long& gnb_id) { void ngap_app::remove_gnb_context(const long& gnb_id) {
std::unique_lock lock(m_gnbid2gnbContext);
if (is_gnb_id_2_gnb_context(gnb_id)) gnbid2gnbContext.erase(gnb_id); if (is_gnb_id_2_gnb_context(gnb_id)) {
std::unique_lock lock(m_gnbid2gnbContext);
gnbid2gnbContext.erase(gnb_id);
return;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment