diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 4080381e6..f39665581 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -2910,7 +2910,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 5bed610cb..41772d8e0 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 6d359b6c8..773116c7c 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -221,7 +221,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 cb34a7562..e32465631 100644 --- a/quinn/src/lib.rs +++ b/quinn/src/lib.rs @@ -96,8 +96,8 @@ enum ConnectionEvent { error_code: VarInt, reason: bytes::Bytes, }, + LocalAddressChanged, Proto(proto::ConnectionEvent), - Ping, } #[derive(Debug)]