Merge "Do not block on control socket."
diff --git a/src/profiling/memory/client.cc b/src/profiling/memory/client.cc
index 8065733..420da4c 100644
--- a/src/profiling/memory/client.cc
+++ b/src/profiling/memory/client.cc
@@ -213,10 +213,7 @@
}
PERFETTO_DCHECK(client_config.interval >= 1);
- // TODO(fmayer): Always make this nonblocking.
- // This is so that without block_client, we get the old behaviour that rate
- // limits using the blocking socket. We do not want to change that for Q.
- sock.SetBlocking(!client_config.block_client);
+ sock.SetBlocking(false);
Sampler sampler{client_config.interval};
// note: the shared_ptr will retain a copy of the unhooked_allocator
return std::allocate_shared<Client>(unhooked_allocator, std::move(sock),
@@ -379,10 +376,12 @@
}
bool Client::SendControlSocketByte() {
- // TODO(fmayer): Fix the special casing that only block_client uses a
- // nonblocking socket.
+ // If base::IsAgain(errno), the socket buffer is full, so the service will
+ // pick up the notification even without adding another byte.
+ // In other error cases (usually EPIPE) we want to disconnect, because that
+ // is how the service signals the tracing session was torn down.
if (sock_.Send(kSingleByte, sizeof(kSingleByte)) == -1 &&
- (!client_config_.block_client || !base::IsAgain(errno))) {
+ !base::IsAgain(errno)) {
PERFETTO_PLOG("Failed to send control socket byte.");
return false;
}
diff --git a/src/profiling/memory/unwinding.cc b/src/profiling/memory/unwinding.cc
index ced87f9..6b030c0 100644
--- a/src/profiling/memory/unwinding.cc
+++ b/src/profiling/memory/unwinding.cc
@@ -303,9 +303,7 @@
shmem.EndRead(std::move(buf));
// Reparsing takes time, so process the rest in a new batch to avoid timing
// out.
- // TODO(fmayer): Do not special case blocking mode.
- if (client_data.client_config.block_client &&
- reparses_before < client_data.metadata.reparses) {
+ if (reparses_before < client_data.metadata.reparses) {
repost_task = true;
break;
}