|
|
@ -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"); |
|
|
|
} |
|
|
|
} |
|
|
|