We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
RelayPool::shutdown
1 parent dbcb8d7 commit 8648a64Copy full SHA for 8648a64
crates/nostr-relay-pool/src/pool/inner.rs
@@ -71,8 +71,10 @@ impl InnerRelayPool {
71
}
72
73
pub async fn shutdown(&self) {
74
- // TODO: use atomic swap?
75
- if self.is_shutdown() {
+ // Mark as shutdown
+ // If the previous value was `true`,
76
+ // meaning that was already shutdown, immediately returns.
77
+ if self.atomic.shutdown.swap(true, Ordering::SeqCst) {
78
return;
79
80
@@ -83,9 +85,6 @@ impl InnerRelayPool {
83
85
let _ = self
84
86
.notification_sender
87
.send(RelayPoolNotification::Shutdown);
-
- // Mark as shutdown
88
- self.atomic.shutdown.store(true, Ordering::SeqCst);
89
90
91
pub async fn force_remove_all_relays(&self) {
0 commit comments