Merge "Temporary hack to fix TLS bug." into cobalt-v1.6.x
diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c
index a25fba4..29d9431 100644
--- a/src/core/lib/iomgr/tcp_client_posix.c
+++ b/src/core/lib/iomgr/tcp_client_posix.c
@@ -281,6 +281,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);