Skip to content

Commit

Permalink
quic: prevent copying ngtcp2_cid
Browse files Browse the repository at this point in the history
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: #48561
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
  • Loading branch information
tniessen authored Jun 28, 2023
1 parent 900ae1b commit 546797f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/quic/session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 546797f

Please sign in to comment.