Commit 610acd8e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix_timeout_pdu_session_release' into 'develop'

Fix issue when there's no valid reply from UPF for PDU session release

See merge request oai/cn5g/oai-cn5g-smf!155
parents c402156f 3ba7955a
......@@ -85,12 +85,22 @@ void IndividualSMContextApiImpl::release_sm_context(
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_release_sm_context_request(itti_msg);
// Wait for the result from APP and send reply to AMF
boost::future_status status;
// wait for timeout or ready
status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
if (status == boost::future_status::ready) {
assert(f.is_ready());
assert(f.has_value());
assert(!f.has_exception());
// Wait for the result from APP and send reply to NF consumer (e.g., AMF)
smf::pdu_session_release_sm_context_response sm_context_response = f.get();
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
// TODO: Process the response
response.send(Pistache::Http::Code(sm_context_response.get_http_code()));
} else {
response.send(Pistache::Http::Code::Request_Timeout);
}
}
void IndividualSMContextApiImpl::retrieve_sm_context(
......@@ -138,7 +148,14 @@ void IndividualSMContextApiImpl::update_sm_context(
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
// Wait for the result from APP and send reply to AMF
boost::future_status status;
// wait for timeout or ready
status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
if (status == boost::future_status::ready) {
assert(f.is_ready());
assert(f.has_value());
assert(!f.has_exception());
// Wait for the result from APP and send reply to NF consumer (e.g., AMF)
smf::pdu_session_update_sm_context_response sm_context_response = f.get();
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
......@@ -158,7 +175,8 @@ void IndividualSMContextApiImpl::update_sm_context(
sm_context_response.get_n2_sm_information(), json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY)));
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (sm_context_response.n1_sm_msg_is_set()) {
mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY,
......@@ -166,7 +184,8 @@ void IndividualSMContextApiImpl::update_sm_context(
multipart_related_content_part_e::NAS, json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY)));
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (sm_context_response.n2_sm_info_is_set()) {
mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY,
......@@ -174,7 +193,8 @@ void IndividualSMContextApiImpl::update_sm_context(
multipart_related_content_part_e::NGAP, json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY)));
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (json_data.size() > 0) {
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(json_format));
......@@ -186,6 +206,9 @@ void IndividualSMContextApiImpl::update_sm_context(
response.send(
Pistache::Http::Code(sm_context_response.get_http_code()), body);
} else {
response.send(Pistache::Http::Code::Request_Timeout);
}
}
} // namespace api
} // namespace smf_server
......
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