Skip to content

Commit d1ab1f1

Browse files
authored
Use Acquire/Release ordering for the application ID (#3340)
`Relaxed` is the wrong ordering to use in the case of the application ID, as there is nothing guaranteeing that `Http::application_id()` will read the value *after* it was set by `Http::set_application_id()`.
1 parent 891e400 commit d1ab1f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/http/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl Http {
209209
}
210210

211211
pub fn application_id(&self) -> Option<ApplicationId> {
212-
let application_id = self.application_id.load(Ordering::Relaxed);
212+
let application_id = self.application_id.load(Ordering::Acquire);
213213
NonZeroU64::new(application_id).map(ApplicationId::from)
214214
}
215215

@@ -218,7 +218,7 @@ impl Http {
218218
}
219219

220220
pub fn set_application_id(&self, application_id: ApplicationId) {
221-
self.application_id.store(application_id.get(), Ordering::Relaxed);
221+
self.application_id.store(application_id.get(), Ordering::Release);
222222
}
223223

224224
pub fn token(&self) -> &str {

0 commit comments

Comments
 (0)