Temporary hack to fix TLS bug.
This is a temporary workaround for
CB-63
and
https://github.com/grpc/grpc/issues/12711
Change-Id: I86647c05907d20ba38065b87a1d85fdc8bc17ad7
diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c
index 5c7da99..b2403ab 100644
--- a/src/core/lib/iomgr/tcp_client_posix.c
+++ b/src/core/lib/iomgr/tcp_client_posix.c
@@ -295,6 +295,15 @@
GPR_ASSERT(addr->len < ~(socklen_t)0);
err =
connect(fd, (const struct sockaddr *)addr->addr, (socklen_t)addr->len);
+ if (err >= 0) {
+ // Note(rudominer) This is a temporary hack designed to work around two
+ // bugs:
+ // (1) Fuchsia's implementation of connect() does not honor O_NONBLOCK
+ // (2) gRPC with TLS does not complete the TLS handshake if the branch
+ // "if (err >= 0)" below is taken.
+ err = -1;
+ errno = EINPROGRESS;
+ }
} while (err < 0 && errno == EINTR);
addr_str = grpc_sockaddr_to_uri(addr);