diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index b70a0abcc0..ec46ffa718 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -2907,7 +2907,7 @@ impl Connection { } /// Switch to a previously unused remote connection ID, if possible - fn update_rem_cid(&mut self) { + pub fn update_rem_cid(&mut self) { let (reset_token, retired) = match self.rem_cids.next() { Some(x) => x, None => return, diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 5bed610cb5..41772d8e0d 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -915,7 +915,8 @@ impl State { ) -> Result<(), ConnectionError> { loop { match self.conn_events.poll_recv(cx) { - Poll::Ready(Some(ConnectionEvent::Ping)) => { + Poll::Ready(Some(ConnectionEvent::LocalAddressChanged)) => { + self.inner.update_rem_cid(); self.inner.ping(); } Poll::Ready(Some(ConnectionEvent::Proto(event))) => { diff --git a/quinn/src/endpoint.rs b/quinn/src/endpoint.rs index dfbdee5eb9..6d2822a878 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -218,7 +218,7 @@ impl Endpoint { // Generate some activity so peers notice the rebind for sender in inner.connections.senders.values() { // Ignoring errors from dropped connections - let _ = sender.send(ConnectionEvent::Ping); + let _ = sender.send(ConnectionEvent::LocalAddressChanged); } Ok(()) diff --git a/quinn/src/lib.rs b/quinn/src/lib.rs index f1d8db5cbe..0e1a4c9020 100644 --- a/quinn/src/lib.rs +++ b/quinn/src/lib.rs @@ -94,8 +94,8 @@ enum ConnectionEvent { error_code: VarInt, reason: bytes::Bytes, }, + LocalAddressChanged, Proto(proto::ConnectionEvent), - Ping, } #[derive(Debug)]