nostr-rs-relay

My dev fork of nostr-rs-relay
git clone git://jb55.com/nostr-rs-relay
Log | Files | Refs | README | LICENSE

commit f8b1fe5035fe63b19e8f6bb448887953cb6d8436
parent f2001dc34a36151400a0fcc0d1583695727dea61
Author: Greg Heartsfield <scsibug@imap.cc>
Date:   Thu, 17 Feb 2022 16:18:05 -0600

docs: line up comments with code

Diffstat:
Msrc/event.rs | 3+++
Msrc/main.rs | 8++++----
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git 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 @@ -375,10 +375,6 @@ async fn nostr_server( // Create channel for receiving NOTICEs let (notice_tx, mut notice_rx) = mpsc::channel::<String>(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<String, oneshot::Sender<()>> = 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;