Revert "Incorporate changes to grpc_sockaddr_to_string API"

This reverts commit 401f76e573.
pull/22933/head
Alexander Polcyn 5 years ago
parent 6640651bcf
commit 2958c2b622
  1. 11
      src/core/lib/iomgr/tcp_client_posix.cc

@ -294,14 +294,11 @@ static char* extract_source_ip(int fd) {
resolved_address.len = sizeof(resolved_address.addr); resolved_address.len = sizeof(resolved_address.addr);
char* out = nullptr; char* out = nullptr;
if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(&resolved_address.addr), if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(&resolved_address.addr),
&resolved_address.len) != -1) { &resolved_address.len) == -1 ||
std::string result = grpc_sockaddr_to_string(&out, &resolved_address, false /* normalize */) ==
grpc_sockaddr_to_string(&resolved_address, false /* normalize */); -1) {
out = gpr_strdup(result.c_str());
} else {
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"source address will be missing from logs and errors. gotsockname " "source address will be missing from logs and errors. errno: %d",
"errno: %d",
errno); errno);
out = gpr_strdup("source_address_extraction_failed"); out = gpr_strdup("source_address_extraction_failed");
} }

Loading…
Cancel
Save