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 authored and GitHub committed 2023-06-28 11:52:45 +00:00
1 parent 900ae1bda7
commit 546797f2b1
1 file changed
+1 -1
+1 -1
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)