Send padding if there's nothing to retransmit in Quartc's SendProbingData(). If there is anything to retransmit, Quartc will use it for probing. If not, Quartc will simply send a packet full of padding. (The latter will be useful when Quartc only sends datagram frames.) gfe-relnote: n/a (probing retransmissions only used by Quartc) PiperOrigin-RevId: 245822135 Change-Id: Ia9ef50ba6cc649fc70530b64031d5ea19fcc9d24
diff --git a/quic/quartc/quartc_session.cc b/quic/quartc/quartc_session.cc index 80031dd..38e1c62 100644 --- a/quic/quartc/quartc_session.cc +++ b/quic/quartc/quartc_session.cc
@@ -64,6 +64,8 @@ } void QuartcSession::ProcessSendMessageQueue() { + QuicConnection::ScopedPacketFlusher flusher( + connection(), QuicConnection::AckBundling::NO_ACK); while (!send_message_queue_.empty()) { struct iovec iov = {const_cast<char*>(send_message_queue_.front().data()), send_message_queue_.front().length()}; @@ -120,6 +122,17 @@ QuicSession::OnCanWrite(); } +bool QuartcSession::SendProbingData() { + if (QuicSession::SendProbingData()) { + return true; + } + + SetTransmissionType(PROBING_RETRANSMISSION); + SendPing(); + WriteControlFrame(QuicFrame(QuicPaddingFrame())); + return true; +} + void QuartcSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { QuicSession::OnCryptoHandshakeEvent(event); switch (event) { @@ -197,7 +210,7 @@ void QuartcSession::SetDelegate(Delegate* session_delegate) { if (session_delegate_) { - LOG(WARNING) << "The delegate for the session has already been set."; + QUIC_LOG(WARNING) << "The delegate for the session has already been set."; } session_delegate_ = session_delegate; DCHECK(session_delegate_); @@ -337,7 +350,7 @@ std::vector<std::string>{kDummyCertName}, /*cert_sct=*/"", /*chlo_hash=*/"", /*signature=*/"anything"); } else { - LOG(DFATAL) << "Unable to set server config, error=" << error; + QUIC_LOG(DFATAL) << "Unable to set server config, error=" << error; } }
diff --git a/quic/quartc/quartc_session.h b/quic/quartc/quartc_session.h index 29e6306..9da306e 100644 --- a/quic/quartc/quartc_session.h +++ b/quic/quartc/quartc_session.h
@@ -67,6 +67,7 @@ bool ShouldKeepConnectionAlive() const override; void OnCanWrite() override; + bool SendProbingData() override; void OnConnectionClosed(QuicErrorCode error, const std::string& error_details,
diff --git a/quic/quartc/test/quartc_peer.cc b/quic/quartc/test/quartc_peer.cc index 8aa1c1a..036ba03 100644 --- a/quic/quartc/test/quartc_peer.cc +++ b/quic/quartc/test/quartc_peer.cc
@@ -71,7 +71,6 @@ void QuartcPeer::OnCryptoHandshakeComplete() { SetEnabled(true); - session_->SendPing(); // Hack to make probing work. } void QuartcPeer::OnConnectionWritable() {
diff --git a/quic/quartc/test/quartc_peer_test.cc b/quic/quartc/test/quartc_peer_test.cc index 9b4f3fb..9f76fe6 100644 --- a/quic/quartc/test/quartc_peer_test.cc +++ b/quic/quartc/test/quartc_peer_test.cc
@@ -10,6 +10,7 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/quartc/quartc_endpoint.h" #include "net/third_party/quiche/src/quic/quartc/simulated_packet_transport.h" +#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/link.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h" @@ -31,7 +32,9 @@ client_server_link_(&client_transport_, &server_transport_, QuicBandwidth::FromKBitsPerSecond(512), - QuicTime::Delta::FromMilliseconds(100)) {} + QuicTime::Delta::FromMilliseconds(100)) { + simulator_.set_random_generator(&rng_); + } void CreatePeers(const std::vector<QuartcDataSource::Config>& configs) { client_peer_ = QuicMakeUnique<QuartcPeer>( @@ -59,6 +62,7 @@ client_endpoint_->Connect(&client_transport_); } + SimpleRandom rng_; simulator::Simulator simulator_; simulator::SimulatedQuartcPacketTransport client_transport_; simulator::SimulatedQuartcPacketTransport server_transport_; @@ -124,7 +128,7 @@ Connect(); // Run long enough for the bandwidth estimate to ramp up. - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); // The peers generate frames that fit in one packet. EXPECT_LT(client_peer_->received_messages().back().frame.size, @@ -143,7 +147,7 @@ Connect(); // Run long enough for the bandwidth estimate to ramp up. - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); // The peers generate frames that fit in one packet. EXPECT_LT(client_peer_->received_messages().back().frame.size, @@ -164,10 +168,7 @@ Connect(); // Run long enough for the bandwidth estimate to ramp up. - // Note that the ramp-up time is longer for this test because of the long - // frame_interval. This seems especially true when QUIC enables all flags for - // testing. - simulator_.RunFor(QuicTime::Delta::FromSeconds(30)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); EXPECT_EQ(client_peer_->received_messages().back().frame.size, 100); EXPECT_EQ(server_peer_->received_messages().back().frame.size, 100); @@ -182,7 +183,7 @@ Connect(); // Run long enough for the bandwidth estimate to ramp up. - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); // Max frame sizes smaller than the header are ignored, and the frame size is // limited by packet size. @@ -271,7 +272,7 @@ // Run for long enough that bandwidth ramps up and meets the requirements of // all three sources. - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); // The last message from each source should be the size allowed by that // source's maximum bandwidth and frame interval. @@ -323,7 +324,7 @@ Connect(); // Run for long enough that bandwidth ramps up to link capacity. - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); const std::vector<ReceivedMessage>& client_messages = client_peer_->received_messages(); @@ -371,7 +372,7 @@ CreatePeers({config}); Connect(); - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); // After these calls, we should observe no new messages. server_peer_->SetEnabled(false); @@ -382,7 +383,7 @@ std::map<int32_t, int64_t> last_sent_by_server = server_peer_->GetLastSequenceNumbers(); - simulator_.RunFor(QuicTime::Delta::FromSeconds(15)); + simulator_.RunFor(QuicTime::Delta::FromSeconds(10)); ASSERT_FALSE(client_peer_->received_messages().empty()); EXPECT_EQ(client_peer_->received_messages().back().frame.sequence_number,