summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/Android/AdbClient.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-05-03 14:07:41 +0000
committerPavel Labath <labath@google.com>2016-05-03 14:07:41 +0000
commitef984e7dc09170befecca3df73f16c1a44583eb2 (patch)
tree59756826891f358518e9b3f1ba17e4b4be498816 /lldb/source/Plugins/Platform/Android/AdbClient.cpp
parentc1e6aa7e265f7032f80387dfb977a0bb918807ca (diff)
downloadbcm5719-llvm-ef984e7dc09170befecca3df73f16c1a44583eb2.tar.gz
bcm5719-llvm-ef984e7dc09170befecca3df73f16c1a44583eb2.zip
Revert "Add a read_full_buffer argument to ConnectionFileDescriptor::Read"
This reverts commit r268380 as it breaks windows build (I forgot to make neccesary adjustments to ConnectionGenericFileWindows). llvm-svn: 268384
Diffstat (limited to 'lldb/source/Plugins/Platform/Android/AdbClient.cpp')
-rw-r--r--lldb/source/Plugins/Platform/Android/AdbClient.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
index b4de0a44a4b..736447fd22d 100644
--- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
@@ -34,7 +34,7 @@ using namespace lldb_private::platform_android;
namespace {
-const uint32_t kReadTimeout = 4000000; // 4 seconds
+const uint32_t kReadTimeout = 1000000; // 1 second
const char * kOKAY = "OKAY";
const char * kFAIL = "FAIL";
const char * kDATA = "DATA";
@@ -251,9 +251,7 @@ AdbClient::ReadMessageStream (std::vector<char>& message, uint32_t timeout_ms)
if (elapsed_time >= timeout_ms)
return Error("Timed out");
- const bool read_full_buffer = true;
- size_t n =
- m_conn.Read(buffer, sizeof(buffer), 1000 * (timeout_ms - elapsed_time), read_full_buffer, status, &error);
+ size_t n = m_conn.Read(buffer, sizeof(buffer), 1000 * (timeout_ms - elapsed_time), status, &error);
if (n > 0)
message.insert(message.end(), &buffer[0], &buffer[n]);
}
@@ -492,15 +490,19 @@ AdbClient::ReadSyncHeader (std::string &response_id, uint32_t &data_len)
Error
AdbClient::ReadAllBytes (void *buffer, size_t size)
{
- const bool read_full_buffer = true;
Error error;
ConnectionStatus status;
- size_t read_bytes = m_conn.Read(buffer, size, kReadTimeout, read_full_buffer, status, &error);
- if (error.Fail())
- return error;
- if (read_bytes < size)
- return Error("Unable to read full buffer.");
- return Error();
+ char *read_buffer = static_cast<char*>(buffer);
+
+ size_t tota_read_bytes = 0;
+ while (tota_read_bytes < size)
+ {
+ auto read_bytes = m_conn.Read (read_buffer + tota_read_bytes, size - tota_read_bytes, kReadTimeout, status, &error);
+ if (error.Fail ())
+ return error;
+ tota_read_bytes += read_bytes;
+ }
+ return error;
}
Error
OpenPOWER on IntegriCloud