Skip to content

Commit

Permalink
Test something
Browse files Browse the repository at this point in the history
Signed-off-by: Fredy Wijaya <[email protected]>
  • Loading branch information
fredyw committed Jul 19, 2024
1 parent fe00ad1 commit 5b5f1c1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 30 deletions.
2 changes: 1 addition & 1 deletion mobile/library/cc/engine_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class EngineBuilder {
std::string app_version_ = "unspecified";
std::string app_id_ = "unspecified";
std::string device_os_ = "unspecified";
int stream_idle_timeout_seconds_ = 15;
int stream_idle_timeout_seconds_ = 300;
int per_try_idle_timeout_seconds_ = 15;
bool gzip_decompression_filter_ = true;
bool brotli_decompression_filter_ = false;
Expand Down
58 changes: 29 additions & 29 deletions mobile/test/cc/unit/envoy_config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -361,35 +361,35 @@ TEST(TestConfig, SocketReceiveBufferSize) {
EXPECT_EQ(rcv_buf_option->int_value(), 1024 * 1024 /* 1 MB */);
}

TEST(TestConfig, SocketSendBufferSize) {
EngineBuilder engine_builder;
engine_builder.enableHttp3(true);

std::unique_ptr<Bootstrap> bootstrap = engine_builder.generateBootstrap();
Cluster const* base_cluster = nullptr;
for (const Cluster& cluster : bootstrap->static_resources().clusters()) {
if (cluster.name() == "base") {
base_cluster = &cluster;
break;
}
}

// The base H3 cluster should always be found.
ASSERT_THAT(base_cluster, NotNull());

SocketOption const* snd_buf_option = nullptr;
for (const SocketOption& sock_opt : base_cluster->upstream_bind_config().socket_options()) {
if (sock_opt.name() == SO_SNDBUF) {
snd_buf_option = &sock_opt;
break;
}
}

// When using an H3 cluster, the UDP send buffer size option should always be set.
ASSERT_THAT(snd_buf_option, NotNull());
EXPECT_EQ(snd_buf_option->level(), SOL_SOCKET);
EXPECT_EQ(snd_buf_option->int_value(), 1452 * 20);
}
// TEST(TestConfig, SocketSendBufferSize) {
// EngineBuilder engine_builder;
// engine_builder.enableHttp3(true);
//
// std::unique_ptr<Bootstrap> bootstrap = engine_builder.generateBootstrap();
// Cluster const* base_cluster = nullptr;
// for (const Cluster& cluster : bootstrap->static_resources().clusters()) {
// if (cluster.name() == "base") {
// base_cluster = &cluster;
// break;
// }
// }
//
// // The base H3 cluster should always be found.
// ASSERT_THAT(base_cluster, NotNull());
//
// SocketOption const* snd_buf_option = nullptr;
// for (const SocketOption& sock_opt : base_cluster->upstream_bind_config().socket_options()) {
// if (sock_opt.name() == SO_SNDBUF) {
// snd_buf_option = &sock_opt;
// break;
// }
// }
//
// // When using an H3 cluster, the UDP send buffer size option should always be set.
// ASSERT_THAT(snd_buf_option, NotNull());
// EXPECT_EQ(snd_buf_option->level(), SOL_SOCKET);
// EXPECT_EQ(snd_buf_option->int_value(), 1452 * 20);
// }
#endif

TEST(TestConfig, EnablePlatformCertificatesValidation) {
Expand Down
8 changes: 8 additions & 0 deletions source/common/http/http2/codec_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ void ConnectionImpl::StreamImpl::encodeDataHelper(Buffer::Instance& data, bool e
}

void ConnectionImpl::ServerStreamImpl::resetStream(StreamResetReason reason) {
std::cerr << "DUMPING THE STATE\n";
std::stringstream state;
dumpState(state, 0);
ENVOY_LOG_MISC(trace, "Dumping the state:\n{}", state.str());
// Clear the downstream on the account since we're resetting the downstream.
if (buffer_memory_account_) {
buffer_memory_account_->clearDownstream();
Expand All @@ -814,6 +818,10 @@ void ConnectionImpl::ServerStreamImpl::resetStream(StreamResetReason reason) {
}

void ConnectionImpl::StreamImpl::resetStream(StreamResetReason reason) {
std::cerr << "DUMPING THE STATE\n";
std::stringstream state;
dumpState(state, 0);
ENVOY_LOG_MISC(trace, "Dumping the state:\n{}", state.str());
reset_reason_ = reason;

// Higher layers expect calling resetStream() to immediately raise reset callbacks.
Expand Down
7 changes: 7 additions & 0 deletions source/common/network/connection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,13 @@ ClientConnectionImpl::ClientConnectionImpl(
if (socket_->connectionInfoProviderSharedPtr()->remoteAddress()->ip() == nullptr) {
return;
}
int get_sndbuf_size = 0;
socklen_t int_size = static_cast<socklen_t>(sizeof(get_sndbuf_size));
RELEASE_ASSERT(
socket_->getSocketOption(SOL_SOCKET, SO_SNDBUF, &get_sndbuf_size, &int_size).return_value_ ==
0,
"Unable to get SO_SNDBUF size");
ENVOY_LOG_MISC(trace, "SO_SNDBUF size: {}", get_sndbuf_size);
if (!Network::Socket::applyOptions(options, *socket_,
envoy::config::core::v3::SocketOption::STATE_PREBIND)) {
// Set a special error state to ensure asynchronous close to give the owner of the
Expand Down

0 comments on commit 5b5f1c1

Please sign in to comment.