clean up handling of errors in route spec store

This commit is contained in:
Christien Rioux
2023-10-20 22:39:09 -04:00
parent 353c907497
commit 97be49a9a7
17 changed files with 278 additions and 236 deletions

View File

@@ -413,7 +413,7 @@ impl AssemblyBuffer {
.await;
// Get a message seq
let seq = self.unlocked_inner.next_seq.fetch_add(1, Ordering::Relaxed);
let seq = self.unlocked_inner.next_seq.fetch_add(1, Ordering::AcqRel);
// Chunk it up
let mut offset = 0usize;

View File

@@ -271,7 +271,7 @@ pub async fn test_many_frags_with_drops() {
let first = first.clone();
async move {
// Send only first packet, drop rest
if first.swap(false, Ordering::Relaxed) {
if first.swap(false, Ordering::AcqRel) {
net_tx
.send_async((framed_chunk, remote_addr))
.await
@@ -306,7 +306,7 @@ pub async fn test_many_frags_with_drops() {
Ok(NetworkResult::Value(()))
));
first.store(true, Ordering::Relaxed);
first.store(true, Ordering::Release);
}
println!("all_sent len={}", all_sent.len());

View File

@@ -58,7 +58,7 @@ impl<E: Send + 'static> TickTask<E> {
}
pub fn is_running(&self) -> bool {
self.running.load(core::sync::atomic::Ordering::Relaxed)
self.running.load(core::sync::atomic::Ordering::Acquire)
}
pub async fn stop(&self) -> Result<(), E> {
@@ -120,9 +120,9 @@ impl<E: Send + 'static> TickTask<E> {
let running = self.running.clone();
let routine = self.routine.get().unwrap()(stop_token, last_timestamp_us, now);
let wrapped_routine = Box::pin(async move {
running.store(true, core::sync::atomic::Ordering::Relaxed);
running.store(true, core::sync::atomic::Ordering::Release);
let out = routine.await;
running.store(false, core::sync::atomic::Ordering::Relaxed);
running.store(false, core::sync::atomic::Ordering::Release);
out
});
match self.single_future.single_spawn(wrapped_routine).await {

View File

@@ -18,21 +18,21 @@ extern "C" {
pub fn is_browser() -> bool {
static CACHE: AtomicI8 = AtomicI8::new(-1);
let cache = CACHE.load(Ordering::Relaxed);
let cache = CACHE.load(Ordering::AcqRel);
if cache != -1 {
return cache != 0;
}
let res = Reflect::has(global().as_ref(), &"navigator".into()).unwrap_or_default();
CACHE.store(res as i8, Ordering::Relaxed);
CACHE.store(res as i8, Ordering::AcqRel);
res
}
pub fn is_browser_https() -> bool {
static CACHE: AtomicI8 = AtomicI8::new(-1);
let cache = CACHE.load(Ordering::Relaxed);
let cache = CACHE.load(Ordering::AcqRel);
if cache != -1 {
return cache != 0;
}
@@ -41,7 +41,7 @@ pub fn is_browser_https() -> bool {
.map(|res| res.is_truthy())
.unwrap_or_default();
CACHE.store(res as i8, Ordering::Relaxed);
CACHE.store(res as i8, Ordering::AcqRel);
res
}