Commit 3d122038 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Using a common promise for all SBI message request

parent d8cf620f
......@@ -2059,6 +2059,13 @@ void smf_app::add_promise(
sm_context_release_promises.emplace(id, p);
}
//---------------------------------------------------------------------------------------------
void smf_app::add_promise(
uint32_t id, boost::shared_ptr<boost::promise<nlohmann::json>>& p) {
std::unique_lock lock(m_sbi_server_promises);
sbi_server_promises.emplace(id, p);
}
//---------------------------------------------------------------------------------------------
void smf_app::trigger_create_context_error_response(
const uint32_t& http_code, const uint8_t& cause,
......
......@@ -117,6 +117,7 @@ class smf_app {
mutable std::shared_mutex m_sm_context_create_promises;
mutable std::shared_mutex m_sm_context_update_promises;
mutable std::shared_mutex m_sm_context_release_promises;
mutable std::shared_mutex m_sbi_server_promises;
std::map<
uint32_t,
......@@ -131,6 +132,9 @@ class smf_app {
boost::promise<pdu_session_release_sm_context_response>>>
sm_context_release_promises;
std::map<uint32_t, boost::shared_ptr<boost::promise<nlohmann::json>>>
sbi_server_promises;
smf_profile nf_instance_profile; // SMF profile
std::string smf_instance_id; // SMF instance id
timer_id_t timer_nrf_heartbeat;
......@@ -753,6 +757,18 @@ class smf_app {
boost::shared_ptr<
boost::promise<pdu_session_release_sm_context_response>>& p);
/*
* To store a promise of a SBI Server response message to be
* triggered when the result is ready
* @param [uint32_t] id: promise id
* @param [boost::shared_ptr<
* boost::promise<nlohmann::json> >&] p: pointer to
* the promise
* @return void
*/
void add_promise(
uint32_t id, boost::shared_ptr<boost::promise<nlohmann::json>>& p);
/*
* To trigger the response to the HTTP server by set the value of the
* corresponding promise to ready
......
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