summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/Editline.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-05-03 13:55:53 +0000
committerPavel Labath <labath@google.com>2016-05-03 13:55:53 +0000
commit240760207eebc826f86840cceacb95914752271c (patch)
treee188147e7db919e399ce48ebb1d63f595606f6cd /lldb/source/Host/common/Editline.cpp
parentfe98b2f54b0478537b9869708a6d87eafb326a1f (diff)
downloadbcm5719-llvm-240760207eebc826f86840cceacb95914752271c.tar.gz
bcm5719-llvm-240760207eebc826f86840cceacb95914752271c.zip
Add a read_full_buffer argument to ConnectionFileDescriptor::Read
Summary: AdbClient was attempting to handle the case where the socket input arrived in pieces, but it was failing to handle the case where the connection was closed before that happened. In this case, it would just spin in an infinite loop calling Connection::Read. (This was also the cause of the spurious timeouts on the darwin->android buildbot. The exact cause of the premature EOF remains to be investigated, but is likely a server bug.) Since this wait-for-a-certain-number-of-bytes seems like a useful functionality to have, I am moving it (with the infinite loop fixed) to the Connection class, and adding an appropriate test for it. Reviewers: clayborg, zturner, ovyalov Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: http://reviews.llvm.org/D19533 llvm-svn: 268380
Diffstat (limited to 'lldb/source/Host/common/Editline.cpp')
-rw-r--r--lldb/source/Host/common/Editline.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index 4640154c6cb..3842dc1a956 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -580,6 +580,7 @@ Editline::GetCharacter (EditLineCharType * c)
// Read an actual character
while (true)
{
+ const bool read_full_buffer = false; // Doesn't really matter, we're reading one byte only.
lldb::ConnectionStatus status = lldb::eConnectionStatusSuccess;
char ch = 0;
@@ -588,12 +589,12 @@ Editline::GetCharacter (EditLineCharType * c)
// for someone to interrupt us. After Read returns, immediately lock the mutex again and
// check if we were interrupted.
m_output_mutex.Unlock();
- int read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL);
+ int read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, read_full_buffer, status, NULL);
m_output_mutex.Lock();
if (m_editor_status == EditorStatus::Interrupted)
{
while (read_count > 0 && status == lldb::eConnectionStatusSuccess)
- read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL);
+ read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, read_full_buffer, status, NULL);
lldbassert(status == lldb::eConnectionStatusInterrupted);
return 0;
}
OpenPOWER on IntegriCloud