1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-22 16:02:34 +03:00

fix numMigrations increment

Summary: we should only increment numMigrations if the peer is attempting migration from a previously unseen addr

Reviewed By: kvtsoy, sharmafb

Differential Revision: D55884605

fbshipit-source-id: 9204ed785195a321d7f8f7497151b7cfe5f745f7
This commit is contained in:
Hani Damlaj
2024-04-09 10:47:55 -07:00
committed by Facebook GitHub Bot
parent a8543fd9b8
commit 1730ed8a73
2 changed files with 26 additions and 1 deletions

View File

@@ -579,7 +579,6 @@ void onConnectionMigration(
throw QuicTransportException(
"Too many migrations", TransportErrorCode::INVALID_MIGRATION);
}
++conn.migrationState.numMigrations;
bool hasPendingPathChallenge = conn.pendingEvents.pathChallenge.has_value();
// Clear any pending path challenge frame that is not sent
@@ -591,6 +590,7 @@ void onConnectionMigration(
previousPeerAddresses.end(),
newPeerAddress);
if (it == previousPeerAddresses.end()) {
++conn.migrationState.numMigrations;
// send new path challenge
conn.pendingEvents.pathChallenge.emplace(folly::Random::secureRand64());