summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Core/Communication.cpp13
-rw-r--r--lldb/source/Core/ConnectionFileDescriptor.cpp8
2 files changed, 14 insertions, 7 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp
index cf58aa5eff8..6b8a6fe530b 100644
--- a/lldb/source/Core/Communication.cpp
+++ b/lldb/source/Core/Communication.cpp
@@ -293,7 +293,8 @@ Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broad
lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
"%p Communication::AppendBytesToCache (src = %p, src_len = %zu, broadcast = %i)",
this, bytes, len, broadcast);
- if (bytes == NULL || len == 0)
+ if ((bytes == NULL || len == 0)
+ && (status != lldb::eConnectionStatusEndOfFile))
return;
if (m_callback)
{
@@ -348,6 +349,13 @@ Communication::ReadThread (void *p)
size_t bytes_read = comm->ReadFromConnection (buf, sizeof(buf), status, &error);
if (bytes_read > 0)
comm->AppendBytesToCache (buf, bytes_read, true, status);
+ else if ((bytes_read == 0)
+ && status == eConnectionStatusEndOfFile)
+ {
+ if (comm->GetCloseOnEOF ())
+ comm->Disconnect ();
+ comm->AppendBytesToCache (buf, bytes_read, true, status);
+ }
}
switch (status)
@@ -356,6 +364,9 @@ Communication::ReadThread (void *p)
break;
case eConnectionStatusEndOfFile:
+ if (comm->GetCloseOnEOF())
+ done = true;
+ break;
case eConnectionStatusNoConnection: // No connection
case eConnectionStatusLostConnection: // Lost connection while connected to a valid connection
done = true;
diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp
index 30cab9f4c32..1b653780516 100644
--- a/lldb/source/Core/ConnectionFileDescriptor.cpp
+++ b/lldb/source/Core/ConnectionFileDescriptor.cpp
@@ -155,13 +155,9 @@ ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &sta
Error error;
ssize_t bytes_read = ::read (m_fd, dst, dst_len);
if (bytes_read == 0)
-// Disable the end-of-file special handling stuff for now. Hopefully re-instate it (properly fixed) at a
-// later date:
{
-// error.Clear(); // End-of-file. Do not automatically close; pass along for the end-of-file handlers.
-// status = eConnectionStatusEndOfFile;
- error.SetErrorStringWithFormat("End-of-file.\n");
- status = eConnectionStatusLostConnection;
+ error.Clear(); // End-of-file. Do not automatically close; pass along for the end-of-file handlers.
+ status = eConnectionStatusEndOfFile;
}
else if (bytes_read < 0)
{
OpenPOWER on IntegriCloud