Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed May 23, 2024
1 parent da2a70b commit cac6b33
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/runtime/rpc/rpc_host_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "utils/api_utilities.h"
#include "utils/error_code.h"
#include "utils/ports.h"
#include "utils/safe_strerror_posix.h"
#include "utils/string_conv.h"
#include "utils/timer.h"
#include "utils/utils.h"
Expand Down Expand Up @@ -223,7 +224,7 @@ error_s host_port::lookup_hostname(uint32_t ip, std::string *hostname)
addr_in.sin_port = 0;
addr_in.sin_addr.s_addr = ip;
char host[NI_MAXHOST];
int rc = ::getnameinfo((struct sockaddr *) (&addr_in),
int rc = ::getnameinfo((struct sockaddr *)(&addr_in),
sizeof(struct sockaddr),
host,
sizeof(host),
Expand All @@ -232,14 +233,14 @@ error_s host_port::lookup_hostname(uint32_t ip, std::string *hostname)
NI_NAMEREQD);
if (dsn_unlikely(rc != 0)) {
if (rc == EAI_SYSTEM) {
return error_s::make(
dsn::ERR_NETWORK_FAILURE,
fmt::format("{}: {}: getnameinfo failed", gai_strerror(rc), dsn::utils::safe_strerror(errno));
return error_s::make(dsn::ERR_NETWORK_FAILURE,
fmt::format("{}: {}: getnameinfo failed",
gai_strerror(rc),
dsn::utils::safe_strerror(errno)));
}

return error_s::make(
dsn::ERR_NETWORK_FAILURE,
fmt::format("{}: getnameinfo failed", gai_strerror(rc)));
return error_s::make(dsn::ERR_NETWORK_FAILURE,
fmt::format("{}: getnameinfo failed", gai_strerror(rc)));
}

*hostname = host;
Expand Down

0 comments on commit cac6b33

Please sign in to comment.