Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/server/connection_handler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ void ConnectionHandlerImpl::ActiveTcpListener::onAcceptWorker(

void ConnectionHandlerImpl::ActiveTcpListener::newConnection(
Network::ConnectionSocketPtr&& socket, std::unique_ptr<StreamInfo::StreamInfo> stream_info) {
// Refresh local address in case it was restored by a listener filter like the original_dst
// filter.
stream_info->setDownstreamLocalAddress(socket->localAddress());

// Find matching filter chain.
const auto filter_chain = config_->filterChainManager().findFilterChain(*socket);
if (filter_chain == nullptr) {
Expand Down
7 changes: 6 additions & 1 deletion test/server/connection_handler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,12 @@ TEST_F(ConnectionHandlerTest, NormalRedirect) {
EXPECT_EQ(1UL, TestUtility::findCounter(stats_store_, "test.downstream_cx_total")->value());
EXPECT_EQ(1UL, TestUtility::findGauge(stats_store_, "test.downstream_cx_active")->value());

EXPECT_CALL(*access_log_, log(_, _, _, _)).Times(1);
EXPECT_CALL(*access_log_, log(_, _, _, _))
.WillOnce(
Invoke([&](const Http::RequestHeaderMap*, const Http::ResponseHeaderMap*,
const Http::ResponseTrailerMap*, const StreamInfo::StreamInfo& stream_info) {
EXPECT_EQ(alt_address, stream_info.downstreamLocalAddress());
}));
connection->close(Network::ConnectionCloseType::NoFlush);
dispatcher_.clearDeferredDeleteList();
EXPECT_EQ(0UL, TestUtility::findGauge(stats_store_, "downstream_cx_active")->value());
Expand Down