diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2021-11-19 19:17:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-18 21:12:44 +0000 |
commit | 21a55485b4ce6bde1437a3638cc1385881a56abb (patch) | |
tree | 094753680fe93ccc17b6e4716897159be908f866 | |
parent | cffe45e0f03d08e7701f8280f13dd1545702f92e (diff) | |
download | mongo-21a55485b4ce6bde1437a3638cc1385881a56abb.tar.gz |
SERVER-61490 disable TCPFastOpen during egress test
(cherry picked from commit 0cae914207ee666c9c3e1d87dd8492f2749b3bf7)
-rw-r--r-- | src/mongo/transport/transport_layer_asio_test.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/transport/transport_layer_asio_test.cpp b/src/mongo/transport/transport_layer_asio_test.cpp index 23ee678b3d0..7272e73899c 100644 --- a/src/mongo/transport/transport_layer_asio_test.cpp +++ b/src/mongo/transport/transport_layer_asio_test.cpp @@ -46,6 +46,7 @@ #include "mongo/stdx/thread.h" #include "mongo/transport/service_entry_point.h" #include "mongo/transport/session_asio.h" +#include "mongo/transport/transport_options_gen.h" #include "mongo/unittest/assert_that.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -468,6 +469,11 @@ private: * is handled safely (translated to a Status holding a SocketException). */ TEST(TransportLayerASIO, EgressConnectionResetByPeerDuringSessionCtor) { + // Under TFO, no SYN is sent until the client has data to send. For this + // test, we need the server to respond when the client hits the failpoint + // in the ASIOSession ctor. So we have to disable TFO. + auto savedTFOClient = std::exchange(transport::gTCPFastOpenClient, false); + auto savedTFOClientRestore = makeGuard([&] { transport::gTCPFastOpenClient = savedTFOClient; }); // The `server` accepts connections, only to immediately reset them. TestFixture tf; asio::io_context ioContext; @@ -485,7 +491,7 @@ TEST(TransportLayerASIO, EgressConnectionResetByPeerDuringSessionCtor) { fp.setMode(FailPoint::off); }); JoinThread ioThread{[&] { ioContext.run(); }}; - ScopeGuard ioContextStop = [&] { ioContext.stop(); }; + auto ioContextStop = makeGuard([&] { ioContext.stop(); }); fp.setMode(FailPoint::alwaysOn); LOGV2(6101602, "Connecting", "port"_attr = server.port()); @@ -519,7 +525,7 @@ TEST(TransportLayerASIO, ConfirmSocketSetOptionOnResetConnections) { accepted.set(true); }); JoinThread ioThread{[&] { ioContext.run(); }}; - ScopeGuard ioContextStop = [&] { ioContext.stop(); }; + auto ioContextStop = makeGuard([&] { ioContext.stop(); }); JoinThread client{[&] { asio::ip::tcp::socket client{ioContext}; client.connect(asio::ip::tcp::endpoint(asio::ip::address_v4::loopback(), server.port())); |