Skip to content

Commit

Permalink
protobuf/echo/Echo: Add some tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
richardapeters committed Nov 18, 2023
1 parent 45fd7da commit 8d8c03e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions infra/stream/BufferingStreamReader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "infra/stream/BufferingStreamReader.hpp"
#include "services/tracer/GlobalTracer.hpp"

namespace infra
{
Expand Down Expand Up @@ -103,6 +104,8 @@ namespace infra
while (!input.Empty())
{
auto range = input.ExtractContiguousRange(std::numeric_limits<std::size_t>::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());
}
}
Expand Down
4 changes: 4 additions & 0 deletions protobuf/echo/Echo.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "protobuf/echo/Echo.hpp"
#include "services/tracer/GlobalTracer.hpp"

namespace services
{
Expand Down Expand Up @@ -95,6 +96,7 @@ namespace services

void EchoOnStreams::ReleaseReader()
{
services::GlobalTracer().Trace() << "ReleaseReader, available = " << readerPtr->Available();
readerAccess.SetAction(nullptr);
bufferedReader = infra::none;
readerPtr = nullptr;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8d8c03e

Please sign in to comment.