Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Wang <[email protected]>
  • Loading branch information
GehaFearless and empiredan authored Jan 30, 2024
1 parent 59830e4 commit d0809d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runtime/rpc/rpc_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ error_s rpc_address::GetAddrInfo(const std::string &hostname, const addrinfo &hi
const int rc = getaddrinfo(hostname.c_str(), nullptr, &hints, &res);
const int err = errno; // preserving the errno from the getaddrinfo() call
AddrInfo result(res, ::freeaddrinfo);
if (rc != 0) {
if (dsn_unlikely(rc != 0)) {
if (rc == EAI_SYSTEM) {
const auto &err_msg = utils::safe_strerror(err);
LOG_ERROR(
"getaddrinfo failed, name = {}, err = {}", hostname, utils::safe_strerror(rc));
return error_s::make(ERR_NETWORK_FAILURE, utils::safe_strerror(err));
"getaddrinfo failed, name = {}, err = {}", hostname, err_msg);
return error_s::make(ERR_NETWORK_FAILURE, err_msg);
}
LOG_ERROR("getaddrinfo failed, name = {}, err = {}", hostname, gai_strerror(rc));
return error_s::make(ERR_NETWORK_FAILURE, gai_strerror(rc));
Expand Down

0 comments on commit d0809d6

Please sign in to comment.