summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Junho Choi <1229714+junhochoi@users.noreply.github.com> 2021-05-28 01:50:36 -0700
committerGravatar GitHub <noreply@github.com> 2021-05-28 09:50:36 +0100
commit059b3d9c333ba61b2dc01f5e14ef95badca4fa03 (patch)
tree2c9653099d1a0ffad06b4751c7a1e674ec5ee518
parentfa78fea40866178179536a779e2c1b1ab2bbdad8 (diff)
downloadquiche-059b3d9c333ba61b2dc01f5e14ef95badca4fa03.tar.gz
quiche-059b3d9c333ba61b2dc01f5e14ef95badca4fa03.tar.zst
quiche-059b3d9c333ba61b2dc01f5e14ef95badca4fa03.zip
don't try to send HANDSHAKE_DONE on the client
`HANDSHAKE_DONE` can only be sent by a server, so don't try to send a packet from the client if the frame hasn't been sent yet.
-rw-r--r--src/lib.rs37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index eacc9d49..a3001979 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4425,7 +4425,7 @@ impl Connection {
// If there are flushable, almost full or blocked streams, use the
// Application epoch.
if (self.is_established() || self.is_in_early_data()) &&
- (!self.handshake_done_sent ||
+ ((self.is_server && !self.handshake_done_sent) ||
self.almost_full ||
self.blocked_limit.is_some() ||
self.dgram_send_queue.has_pending() ||
@@ -8757,6 +8757,41 @@ mod tests {
}
#[test]
+ fn app_limited_not_changed_on_no_new_frames() {
+ let mut config = Config::new(PROTOCOL_VERSION).unwrap();
+ config
+ .set_application_protos(b"\x06proto1\x06proto2")
+ .unwrap();
+ config.set_initial_max_data(50000);
+ config.set_initial_max_stream_data_bidi_local(50000);
+ config.set_initial_max_stream_data_bidi_remote(50000);
+ config.set_max_recv_udp_payload_size(1200);
+ config.verify_peer(false);
+
+ let mut pipe = testing::Pipe::with_client_config(&mut config).unwrap();
+ assert_eq!(pipe.handshake(), Ok(()));
+
+ // Client sends stream data.
+ assert_eq!(pipe.client.stream_send(0, b"a", true), Ok(1));
+ assert_eq!(pipe.advance(), Ok(()));
+
+ // Server reads stream data.
+ let mut b = [0; 15];
+ pipe.server.stream_recv(0, &mut b).unwrap();
+ assert_eq!(pipe.advance(), Ok(()));
+
+ // Client's app_limited is true because its bytes-in-flight
+ // is much smaller than the current cwnd.
+ assert_eq!(pipe.client.recovery.app_limited(), true);
+
+ // Client has no new frames to send - returns Done.
+ assert_eq!(testing::emit_flight(&mut pipe.client), Err(Error::Done));
+
+ // Client's app_limited should remain the same.
+ assert_eq!(pipe.client.recovery.app_limited(), true);
+ }
+
+ #[test]
fn limit_ack_ranges() {
let mut buf = [0; 65535];