From 8d8c03e4364006a9ec4cb312d9b3819cfc6a2723 Mon Sep 17 00:00:00 2001 From: Richard Peters Date: Sat, 18 Nov 2023 16:53:02 +0100 Subject: [PATCH] protobuf/echo/Echo: Add some tracing --- infra/stream/BufferingStreamReader.cpp | 3 +++ protobuf/echo/Echo.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/infra/stream/BufferingStreamReader.cpp b/infra/stream/BufferingStreamReader.cpp index 53c32f5ed..ad2bb40ed 100644 --- a/infra/stream/BufferingStreamReader.cpp +++ b/infra/stream/BufferingStreamReader.cpp @@ -1,4 +1,5 @@ #include "infra/stream/BufferingStreamReader.hpp" +#include "services/tracer/GlobalTracer.hpp" namespace infra { @@ -103,6 +104,8 @@ namespace infra while (!input.Empty()) { auto range = input.ExtractContiguousRange(std::numeric_limits::max()); + if (buffer.max_size() - buffer.size() < range.size()) + services::GlobalTracer().Trace() << "StoreRemainder buffer size = " << buffer.size() << " max is " << buffer.max_size() << " adding " << range.size(); buffer.insert(buffer.end(), range.begin(), range.end()); } } diff --git a/protobuf/echo/Echo.cpp b/protobuf/echo/Echo.cpp index 20cba19e1..59c123410 100644 --- a/protobuf/echo/Echo.cpp +++ b/protobuf/echo/Echo.cpp @@ -1,4 +1,5 @@ #include "protobuf/echo/Echo.hpp" +#include "services/tracer/GlobalTracer.hpp" namespace services { @@ -95,6 +96,7 @@ namespace services void EchoOnStreams::ReleaseReader() { + services::GlobalTracer().Trace() << "ReleaseReader, available = " << readerPtr->Available(); readerAccess.SetAction(nullptr); bufferedReader = infra::none; readerPtr = nullptr; @@ -161,6 +163,8 @@ namespace services if (stream.Failed()) { + services::GlobalTracer().Trace() << "StartReceiveMessage stream failed, available = " << readerPtr->Available(); + bufferedReader->Rewind(start); bufferedReader = infra::none; readerPtr = nullptr;