Commit 4161fe65 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code cleanup

parent 9891f5a8
...@@ -86,7 +86,7 @@ void IndividualSMContextApiImpl::release_sm_context( ...@@ -86,7 +86,7 @@ void IndividualSMContextApiImpl::release_sm_context(
boost::future_status status; boost::future_status status;
// wait for timeout or ready // wait for timeout or ready
status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS)); status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (status == boost::future_status::ready) { if (status == boost::future_status::ready) {
assert(f.is_ready()); assert(f.is_ready());
assert(f.has_value()); assert(f.has_value());
...@@ -163,7 +163,7 @@ void IndividualSMContextApiImpl::update_sm_context( ...@@ -163,7 +163,7 @@ void IndividualSMContextApiImpl::update_sm_context(
bool n1_sm_msg_is_set = false; bool n1_sm_msg_is_set = false;
bool n2_sm_info_is_set = false; bool n2_sm_info_is_set = false;
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (sm_context_response.find("http_code") != sm_context_response.end()) { if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>(); http_code = sm_context_response["http_code"].get<int>();
} }
......
...@@ -118,7 +118,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts( ...@@ -118,7 +118,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
std::string body = {}; std::string body = {};
bool n1_sm_msg_is_set = false; bool n1_sm_msg_is_set = false;
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (sm_context_response.find("http_code") != sm_context_response.end()) { if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>(); http_code = sm_context_response["http_code"].get<int>();
} }
...@@ -136,7 +136,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts( ...@@ -136,7 +136,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
n1_sm_msg_is_set = true; n1_sm_msg_is_set = true;
} }
if (http_code == 201) { if (http_code == http_status_code_e::HTTP_STATUS_CODE_201_CREATED) {
if (sm_context_response.find("smf_context_uri") != if (sm_context_response.find("smf_context_uri") !=
sm_context_response.end()) { sm_context_response.end()) {
response.headers().add<Pistache::Http::Header::Location>( response.headers().add<Pistache::Http::Header::Location>(
......
...@@ -398,7 +398,7 @@ void smf_http2_server::create_sm_contexts_handler( ...@@ -398,7 +398,7 @@ void smf_http2_server::create_sm_contexts_handler(
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string json_format = {}; std::string json_format = {};
bool n1_sm_msg_is_set = false; bool n1_sm_msg_is_set = false;
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (sm_context_response.find("http_code") != sm_context_response.end()) { if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>(); http_code = sm_context_response["http_code"].get<int>();
...@@ -483,7 +483,7 @@ void smf_http2_server::update_sm_context_handler( ...@@ -483,7 +483,7 @@ void smf_http2_server::update_sm_context_handler(
std::string json_format = {}; std::string json_format = {};
bool n1_sm_msg_is_set = false; bool n1_sm_msg_is_set = false;
bool n2_sm_info_is_set = false; bool n2_sm_info_is_set = false;
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (sm_context_response.find("http_code") != sm_context_response.end()) { if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>(); http_code = sm_context_response["http_code"].get<int>();
...@@ -585,7 +585,7 @@ void smf_http2_server::release_sm_context_handler( ...@@ -585,7 +585,7 @@ void smf_http2_server::release_sm_context_handler(
nlohmann::json sm_context_response = f.get(); nlohmann::json sm_context_response = f.get();
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id); Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
int http_code = 408; // TODO: Request_Timeout int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
if (sm_context_response.find("http_code") != sm_context_response.end()) { if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>(); http_code = sm_context_response["http_code"].get<int>();
} }
......
...@@ -1392,7 +1392,7 @@ uint32_t smf_sbi::get_available_response(boost::shared_future<uint32_t>& f) { ...@@ -1392,7 +1392,7 @@ uint32_t smf_sbi::get_available_response(boost::shared_future<uint32_t>& f) {
uint32_t response_code = f.get(); uint32_t response_code = f.get();
return response_code; return response_code;
} else { } else {
return 408; // timeout, TODO: remove hardcoded value return http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
} }
} }
......
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