From f8b1fe5035fe63b19e8f6bb448887953cb6d8436 Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Thu, 17 Feb 2022 16:18:05 -0600 Subject: [PATCH] docs: line up comments with code --- src/event.rs | 3 +++ src/main.rs | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/event.rs b/src/event.rs index c118850..1a4da87 100644 --- a/src/event.rs +++ b/src/event.rs @@ -148,6 +148,8 @@ impl Event { // ** [0, pubkey-hex-string, created-at-num, kind-num, tags-array-of-arrays, content-string] // * serialize with no spaces/newlines let c_opt = self.to_canonical(); + debug!("Canonical: {:?}", &c_opt); + debug!("Canonical: {}", c_opt.as_ref().unwrap()); if c_opt.is_none() { debug!("event could not be canonicalized"); return false; @@ -156,6 +158,7 @@ impl Event { // * compute the sha256sum. let digest: sha256::Hash = sha256::Hash::hash(c.as_bytes()); let hex_digest = format!("{:x}", digest); + debug!("hex is: {}", hex_digest); // * ensure the id matches the computed sha256sum. if self.id != hex_digest { debug!("event id does not match digest"); diff --git a/src/main.rs b/src/main.rs index 62613c6..98fd8d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -375,10 +375,6 @@ async fn nostr_server( // Create channel for receiving NOTICEs let (notice_tx, mut notice_rx) = mpsc::channel::(32); - // maintain a hashmap of a oneshot channel for active subscriptions. - // when these subscriptions are cancelled, make a message - // available to the executing query so it knows to stop. - // last time this client sent data let mut last_message_time = Instant::now(); @@ -391,7 +387,11 @@ async fn nostr_server( let start = tokio::time::Instant::now() + default_ping_dur; let mut ping_interval = tokio::time::interval_at(start, default_ping_dur); + // maintain a hashmap of a oneshot channel for active subscriptions. + // when these subscriptions are cancelled, make a message + // available to the executing query so it knows to stop. let mut running_queries: HashMap> = HashMap::new(); + // for stats, keep track of how many events the client published, // and how many it received from queries. let mut client_published_event_count: usize = 0;