Merge changes I35f8843e,Icd2a94f8,I6c20f3b3
am: 1f1a0009fc
Change-Id: I13b66d553915bf4bdada12e854214d3232150423
This commit is contained in:
commit
1c8ecd77cd
3 changed files with 20 additions and 11 deletions
|
|
@ -221,6 +221,7 @@ cc_test_host {
|
||||||
target: {
|
target: {
|
||||||
windows: {
|
windows: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
ldflags: ["-municode"],
|
||||||
shared_libs: ["AdbWinApi"],
|
shared_libs: ["AdbWinApi"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,21 @@
|
||||||
#include "sysdeps.h"
|
#include "sysdeps.h"
|
||||||
#include "sysdeps/chrono.h"
|
#include "sysdeps/chrono.h"
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
static bool IsWine() {
|
||||||
|
HMODULE ntdll = GetModuleHandleW(L"ntdll.dll");
|
||||||
|
if (!ntdll) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return GetProcAddress(ntdll, "wine_get_version") != nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static bool IsWine() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(sysdeps_socketpair, smoke) {
|
TEST(sysdeps_socketpair, smoke) {
|
||||||
int fds[2];
|
int fds[2];
|
||||||
ASSERT_EQ(0, adb_socketpair(fds)) << strerror(errno);
|
ASSERT_EQ(0, adb_socketpair(fds)) << strerror(errno);
|
||||||
|
|
@ -182,8 +197,10 @@ TEST_F(sysdeps_poll, disconnect) {
|
||||||
|
|
||||||
EXPECT_EQ(1, adb_poll(&pfd, 1, 100));
|
EXPECT_EQ(1, adb_poll(&pfd, 1, 100));
|
||||||
|
|
||||||
// Linux returns POLLIN | POLLHUP, Windows returns just POLLHUP.
|
if (!IsWine()) {
|
||||||
EXPECT_EQ(POLLHUP, pfd.revents & POLLHUP);
|
// Linux returns POLLIN | POLLHUP, Windows returns just POLLHUP.
|
||||||
|
EXPECT_EQ(POLLHUP, pfd.revents & POLLHUP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(sysdeps_poll, fd_count) {
|
TEST_F(sysdeps_poll, fd_count) {
|
||||||
|
|
|
||||||
|
|
@ -610,15 +610,6 @@ static void _fh_socket_init(FH f) {
|
||||||
|
|
||||||
static int _fh_socket_close(FH f) {
|
static int _fh_socket_close(FH f) {
|
||||||
if (f->fh_socket != INVALID_SOCKET) {
|
if (f->fh_socket != INVALID_SOCKET) {
|
||||||
/* gently tell any peer that we're closing the socket */
|
|
||||||
if (shutdown(f->fh_socket, SD_BOTH) == SOCKET_ERROR) {
|
|
||||||
// If the socket is not connected, this returns an error. We want to
|
|
||||||
// minimize logging spam, so don't log these errors for now.
|
|
||||||
#if 0
|
|
||||||
D("socket shutdown failed: %s",
|
|
||||||
android::base::SystemErrorCodeToString(WSAGetLastError()).c_str());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (closesocket(f->fh_socket) == SOCKET_ERROR) {
|
if (closesocket(f->fh_socket) == SOCKET_ERROR) {
|
||||||
// Don't set errno here, since adb_close will ignore it.
|
// Don't set errno here, since adb_close will ignore it.
|
||||||
const DWORD err = WSAGetLastError();
|
const DWORD err = WSAGetLastError();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue