Skip to content

Commit f815053

Browse files
authored
Merge pull request grpc#22868 from apolcyn/dest_address_in_immediate_tcp_errors
Include the destination address in synchronous TCP connect errors
2 parents 420e814 + 65fdff3 commit f815053

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/lib/iomgr/tcp_client_posix.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,13 @@ void grpc_tcp_client_create_from_prepared_fd(
302302
return;
303303
}
304304
if (errno != EWOULDBLOCK && errno != EINPROGRESS) {
305+
grpc_error* error = GRPC_OS_ERROR(errno, "connect");
306+
char* addr_str = grpc_sockaddr_to_uri(addr);
307+
error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
308+
grpc_slice_from_copied_string(addr_str));
309+
gpr_free(addr_str);
305310
grpc_fd_orphan(fdobj, nullptr, nullptr, "tcp_client_connect_error");
306-
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure,
307-
GRPC_OS_ERROR(errno, "connect"));
311+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure, error);
308312
return;
309313
}
310314

0 commit comments

Comments
 (0)