upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-21 13:23:41 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-21 13:45:31 +0000
commit214fa5cbb7dacedfb3227e623e0542351c7d7956 (patch)
tree2fc223a12691c62954316542fc29ee4df466d1fe /src
parentfbcf2e3896b008f15f02a0df804405a346fd3656 (diff)
refactor: use mark_negentropy_unsupported() consistently
Refactor internal code to use the mark_negentropy_unsupported() method instead of direct field access for improved readability.
Diffstat (limited to 'src')
-rw-r--r--src/sync/relay_connection.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/sync/relay_connection.rs b/src/sync/relay_connection.rs
index 82e85ee..5bc0fa3 100644
--- a/src/sync/relay_connection.rs
+++ b/src/sync/relay_connection.rs
@@ -282,9 +282,7 @@ impl RelayConnection {
282 || msg.contains("negentropy"); 282 || msg.contains("negentropy");
283 283
284 if is_negentropy_notice { 284 if is_negentropy_notice {
285 // Mark relay as not supporting NIP-77 285 self.mark_negentropy_unsupported();
286 self.nip77_supported
287 .store(2, std::sync::atomic::Ordering::Relaxed);
288 286
289 tracing::info!( 287 tracing::info!(
290 relay = %url, 288 relay = %url,
@@ -478,13 +476,14 @@ impl RelayConnection {
478 true 476 true
479 } 477 }
480 478
481 /// Mark this relay as not supporting NIP-77 negentropy (for external callers) 479 /// Mark this relay as not supporting NIP-77 negentropy
482 /// 480 ///
483 /// This is called by SyncManager when negentropy retry returns zero events, 481 /// Called when we detect negentropy isn't working for this relay:
484 /// indicating the relay's negentropy implementation is broken. Future batches 482 /// - NOTICE message contains negentropy-related error
485 /// will skip negentropy and use REQ+EOSE directly. 483 /// - negentropy_sync_diff() fails
484 /// - Negentropy retry returns zero events
486 /// 485 ///
487 /// Note: Internal code in this struct uses direct field access instead. 486 /// Future batches will skip negentropy and use REQ+EOSE directly.
488 pub fn mark_negentropy_unsupported(&self) { 487 pub fn mark_negentropy_unsupported(&self) {
489 self.nip77_supported 488 self.nip77_supported
490 .store(2, std::sync::atomic::Ordering::Relaxed); 489 .store(2, std::sync::atomic::Ordering::Relaxed);
@@ -576,9 +575,7 @@ impl RelayConnection {
576 Ok(reconciliation) 575 Ok(reconciliation)
577 } 576 }
578 Err(e) => { 577 Err(e) => {
579 // Mark relay as not supporting NIP-77 578 self.mark_negentropy_unsupported();
580 self.nip77_supported
581 .store(2, std::sync::atomic::Ordering::Relaxed);
582 579
583 // Log warning only once per relay to avoid spam 580 // Log warning only once per relay to avoid spam
584 if !self 581 if !self