summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DevTools/Inspector/RemoteProcess.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/DevTools/Inspector/RemoteProcess.cpp b/DevTools/Inspector/RemoteProcess.cpp
index 189f4a3dba..66a412d8a9 100644
--- a/DevTools/Inspector/RemoteProcess.cpp
+++ b/DevTools/Inspector/RemoteProcess.cpp
@@ -44,6 +44,7 @@ RemoteProcess::RemoteProcess(pid_t pid)
, m_socket(Core::LocalSocket::construct())
{
s_the = this;
+ m_socket->set_blocking(true);
}
void RemoteProcess::handle_identify_response(const JsonObject& response)
@@ -151,10 +152,19 @@ void RemoteProcess::update()
int nread = m_socket->read((u8*)&length, sizeof(length));
ASSERT(nread == sizeof(length));
- auto data = m_socket->read(length);
- ASSERT(data.size() == length);
+ ByteBuffer data;
+ size_t remaining_bytes = length;
+
+ while (remaining_bytes) {
+ auto packet = m_socket->read(remaining_bytes);
+ if (packet.size() == 0)
+ break;
+ data.append(packet.data(), packet.size());
+ remaining_bytes -= packet.size();
+ }
- dbg() << "Got packet size " << length << " and read that many bytes";
+ ASSERT(data.size() == length);
+ dbg() << "Got data size " << length << " and read that many bytes";
auto json_value = JsonValue::from_string(data);
ASSERT(json_value.is_object());