Skip to content

Commit

Permalink
clang-tidy: fixes errors in common/tcp (#37502)
Browse files Browse the repository at this point in the history
part of #28566

Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored Dec 5, 2024
1 parent 885693b commit d76d053
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/common/tcp/async_tcp_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AsyncTcpClientImpl::~AsyncTcpClientImpl() {
connection_->removeConnectionCallbacks(*this);
}

close(Network::ConnectionCloseType::NoFlush);
closeImpl(Network::ConnectionCloseType::NoFlush);
}

bool AsyncTcpClientImpl::connect() {
Expand Down Expand Up @@ -76,7 +76,7 @@ void AsyncTcpClientImpl::onConnectTimeout() {
close(Network::ConnectionCloseType::NoFlush);
}

void AsyncTcpClientImpl::close(Network::ConnectionCloseType type) {
void AsyncTcpClientImpl::closeImpl(Network::ConnectionCloseType type) {
if (connection_ && !closing_) {
closing_ = true;
connection_->close(type);
Expand Down
8 changes: 6 additions & 2 deletions source/common/tcp/async_tcp_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class AsyncTcpClientImpl : public AsyncTcpClient,
AsyncTcpClientImpl(Event::Dispatcher& dispatcher,
Upstream::ThreadLocalCluster& thread_local_cluster,
Upstream::LoadBalancerContext* context, bool enable_half_close);
~AsyncTcpClientImpl();
~AsyncTcpClientImpl() override;

void close(Network::ConnectionCloseType type) override;
void close(Network::ConnectionCloseType type) override { closeImpl(type); }

Network::DetectedCloseType detectedCloseType() const override { return detected_close_; }

Expand Down Expand Up @@ -68,6 +68,10 @@ class AsyncTcpClientImpl : public AsyncTcpClient,
}

private:
// This implements the AsyncTcpClient::close but exists as non-virtual to avoid calling it in the
// destructor.
void closeImpl(Network::ConnectionCloseType type);

struct NetworkReadFilter : public Network::ReadFilterBaseImpl {
NetworkReadFilter(AsyncTcpClientImpl& parent) : parent_(parent) {}

Expand Down

0 comments on commit d76d053

Please sign in to comment.