fix(rpc): invalidate stale in-flight refreshes on reset/reconnect
resetJobs() cleared the in-progress flags but left generations_ untouched, so a refresh WorkFn still executing on the worker when a disconnect cleared state_ could pass completeDispatch's generation check and apply last-connection data onto the new session. Bump every job's generation in resetJobs() so any pre-reset ticket is treated as stale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1310,6 +1310,13 @@ void NetworkRefreshService::resetJobs()
|
|||||||
priceInProgress_.store(false, std::memory_order_release);
|
priceInProgress_.store(false, std::memory_order_release);
|
||||||
encryptionInProgress_.store(false, std::memory_order_release);
|
encryptionInProgress_.store(false, std::memory_order_release);
|
||||||
connectionInitInProgress_.store(false, std::memory_order_release);
|
connectionInitInProgress_.store(false, std::memory_order_release);
|
||||||
|
|
||||||
|
// Bump every job's generation so any ticket minted before this reset (a refresh still
|
||||||
|
// in flight on the worker when a disconnect cleared state_) is treated as stale by
|
||||||
|
// completeDispatch — preventing last-connection data from landing on the new session.
|
||||||
|
for (auto& generation : generations_) {
|
||||||
|
generation.fetch_add(1, std::memory_order_acq_rel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkRefreshService::DispatchTicket NetworkRefreshService::beginDispatch(
|
NetworkRefreshService::DispatchTicket NetworkRefreshService::beginDispatch(
|
||||||
|
|||||||
Reference in New Issue
Block a user