quic: prevent copying ngtcp2_cid

The existing code explicitly uses the CID(const ngtcp2_cid*) constructor
that does not copy the given ngtcp2_cid, but the range-based for loop
still unnecessarily copies the ngtcp2_cid. Use auto& to avoid copying.

PR-URL: https://github.com/nodejs/node/pull/48561
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
Tobias Nießen 2023-06-28 13:52:45 +02:00 committed by GitHub
parent 900ae1bda7
commit 546797f2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -643,7 +643,7 @@ void Session::Destroy() {
endpoint_->DisassociateCID(config_.dcid);
endpoint_->DisassociateCID(config_.preferred_address_cid);
for (auto cid : cids) endpoint_->DisassociateCID(CID(&cid));
for (const auto& cid : cids) endpoint_->DisassociateCID(CID(&cid));
for (const auto& token : tokens) {
if (token.token_present)