Pass the os handle to the tls connection.
This fixes the tls connection failure on Windows.
Bug: 150719467
Test: 'adb pair', 'adb connect' on Windows host machine.
Test: atest adb_tls_connection_test
Change-Id: I54b8945543ad8b430510fa51dd7bea64a119454f
diff --git a/transport.cpp b/transport.cpp
index 447a8fe..be440e2 100644
--- a/transport.cpp
+++ b/transport.cpp
@@ -498,12 +498,18 @@
auto x509 = GenerateX509Certificate(evp_pkey.get());
auto x509_str = X509ToPEMString(x509.get());
auto evp_str = Key::ToPEMString(evp_pkey.get());
+#ifdef _WIN32
+ int osh = cast_handle_to_int(adb_get_os_handle(fd_));
+#else
+ int osh = adb_get_os_handle(fd_);
+#endif
+
#if ADB_HOST
tls_ = TlsConnection::Create(TlsConnection::Role::Client,
#else
tls_ = TlsConnection::Create(TlsConnection::Role::Server,
#endif
- x509_str, evp_str, fd_);
+ x509_str, evp_str, osh);
CHECK(tls_);
#if ADB_HOST
// TLS 1.3 gives the client no message if the server rejected the