diff --git a/neqo-transport/src/connection/mod.rs b/neqo-transport/src/connection/mod.rs index 8e862b58aa..6ba442d548 100644 --- a/neqo-transport/src/connection/mod.rs +++ b/neqo-transport/src/connection/mod.rs @@ -338,7 +338,7 @@ impl Connection { NeqoQlog::default(), now, ); - c.setup_handshake_path(&Rc::new(RefCell::new(path)), now); + c.setup_handshake_path(&Rc::new(RefCell::new(path))); Ok(c) } @@ -1450,7 +1450,7 @@ impl Connection { } if self.state == State::WaitInitial { - self.start_handshake(path, packet, now); + self.start_handshake(path, packet); } if self.state.connected() { @@ -1462,6 +1462,10 @@ impl Connection { // We only allow one path during setup, so apply handshake // path validation to this path. path.borrow_mut().set_valid(now); + } else if self.role == Role::Client && packet.packet_type() == PacketType::Initial { + // If we are a client and we receive an Initial packet, we can + // assume that the server has validated the path. + path.borrow_mut().set_valid(now); } } @@ -1644,7 +1648,7 @@ impl Connection { /// During connection setup, the first path needs to be setup. /// This uses the connection IDs that were provided during the handshake /// to setup that path. - fn setup_handshake_path(&mut self, path: &PathRef, now: Instant) { + fn setup_handshake_path(&mut self, path: &PathRef) { self.paths.make_permanent( path, Some(self.local_initial_source_cid.clone()), @@ -1658,7 +1662,6 @@ impl Connection { .clone(), ), ); - path.borrow_mut().set_valid(now); } /// If the path isn't permanent, assign it a connection ID to make it so. @@ -1697,7 +1700,7 @@ impl Connection { // First try to fill in handshake details. if packet.packet_type() == PacketType::Initial { self.remote_initial_source_cid = Some(ConnectionId::from(packet.scid())); - self.setup_handshake_path(path, now); + self.setup_handshake_path(path); } else { // Otherwise try to get a usable connection ID. mem::drop(self.ensure_permanent(path)); @@ -1705,7 +1708,7 @@ impl Connection { } } - fn start_handshake(&mut self, path: &PathRef, packet: &PublicPacket, now: Instant) { + fn start_handshake(&mut self, path: &PathRef, packet: &PublicPacket) { qtrace!([self], "starting handshake"); debug_assert_eq!(packet.packet_type(), PacketType::Initial); self.remote_initial_source_cid = Some(ConnectionId::from(packet.scid())); @@ -1714,7 +1717,7 @@ impl Connection { self.cid_manager .add_odcid(self.original_destination_cid.as_ref().unwrap().clone()); // Make a path on which to run the handshake. - self.setup_handshake_path(path, now); + self.setup_handshake_path(path); self.zero_rtt_state = match self.crypto.enable_0rtt(self.version, self.role) { Ok(true) => { diff --git a/neqo-transport/src/recovery/mod.rs b/neqo-transport/src/recovery/mod.rs index e697e78695..13f1071e8f 100644 --- a/neqo-transport/src/recovery/mod.rs +++ b/neqo-transport/src/recovery/mod.rs @@ -893,7 +893,9 @@ impl LossRecovery { } self.stats.borrow_mut().lost += lost_packets.len(); - self.maybe_fire_pto(primary_path.borrow().rtt(), now, &mut lost_packets); + if primary_path.borrow().is_valid() { + self.maybe_fire_pto(primary_path.borrow().rtt(), now, &mut lost_packets); + } lost_packets } @@ -922,7 +924,7 @@ impl LossRecovery { } else { SendProfile::new_limited(mtu) } - } else if sender.recovery_packet() { + } else if path.is_valid() && sender.recovery_packet() { // After entering recovery, allow a packet to be sent immediately. // This uses the PTO machinery, probing in all spaces. This will // result in a PING being sent in every active space. diff --git a/qns/interop.sh b/qns/interop.sh index e216e49866..8c4a6ecf90 100755 --- a/qns/interop.sh +++ b/qns/interop.sh @@ -26,7 +26,7 @@ server) -name "$CERT" -passout pass: -out "$P12CERT" pk12util -d "sql:$DB" -i "$P12CERT" -W '' certutil -L -d "sql:$DB" -n "$CERT" - RUST_LOG=info RUST_BACKTRACE=1 neqo-server --cc cubic --qns-test "$TESTCASE" \ + RUST_LOG=debug RUST_BACKTRACE=1 neqo-server --cc cubic --qns-test "$TESTCASE" \ --qlog-dir "$QLOGDIR" -d "$DB" -k "$CERT" '[::]:443' 2> >(tee -i -a "/logs/$ROLE.log" >&2) ;;