Skip to content

Commit

Permalink
chore: address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
BarisTanyeri committed Dec 2, 2024
1 parent 518e315 commit 4fd47c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
10 changes: 7 additions & 3 deletions services/network/HttpClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,19 @@ namespace services
{
bodyReader.Emplace(ConnectionObserver::Subject().ReceiveStream(), *contentLength);
auto reader = infra::MakeContainedSharedObject(bodyReader->countingReader, bodyReaderAccess.MakeShared(bodyReader));
BodyReaderAvailable(reader);
BodyReaderAvailable(std::move(reader));

if (HttpClient::IsAttached())
Observer().BodyAvailable(std::move(reader));
repeat = chunkedEncoding && contentLength == 0;
}
}
}

void HttpClientImpl::BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader)
{
if (HttpClient::IsAttached())
Observer().BodyAvailable(std::move(bodyReader));
}

void HttpClientImpl::BodyReaderDestroyed()
{
ConnectionObserver::Subject().AckReceived();
Expand Down
2 changes: 1 addition & 1 deletion services/network/HttpClientImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace services
void BodyComplete();

protected:
virtual void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding> bodyReader){};
virtual void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader);

private:
void ExpectResponse();
Expand Down
8 changes: 4 additions & 4 deletions services/network/TracingHttpClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace services
, tracer(tracer)
{}

void TracingHttpClientImpl::BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding> bodyReader)
void TracingHttpClientImpl::BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader)
{
tracer.Trace() << "HttpClientImpl::BodyAvailable; received response:" << infra::endl;

Expand All @@ -18,7 +18,7 @@ namespace services
tracer.Trace() << infra::ByteRangeAsString(stream.ContiguousRange());

reader->Rewind(marker);
reader = nullptr;
HttpClientImpl::BodyReaderAvailable(std::move(reader));
}

void TracingHttpClientImpl::Attached()
Expand Down Expand Up @@ -54,7 +54,7 @@ namespace services
, tracer(tracer)
{}

void TracingHttpClientImplWithRedirection::BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding> bodyReader)
void TracingHttpClientImplWithRedirection::BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader)
{
tracer.Trace() << "HttpClientImplWithRedirection::BodyAvailable; received response:" << infra::endl;

Expand All @@ -65,7 +65,7 @@ namespace services
tracer.Trace() << infra::ByteRangeAsString(stream.ContiguousRange());

reader->Rewind(marker);
reader = nullptr;
HttpClientImplWithRedirection::BodyReaderAvailable(std::move(reader));
}

void TracingHttpClientImplWithRedirection::Attached()
Expand Down
4 changes: 2 additions & 2 deletions services/network/TracingHttpClientImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace services

protected:
// Implementation of HttpClientImplWithRedirection
void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding> bodyReader) override;
void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader) override;

private:
class TracingWriter
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace services

protected:
// Implementation of HttpClientImplWithRedirection
void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding> bodyReader) override;
void BodyReaderAvailable(infra::SharedPtr<infra::CountingStreamReaderWithRewinding>&& bodyReader) override;

private:
class TracingWriter
Expand Down

0 comments on commit 4fd47c4

Please sign in to comment.