From 1e6bf40d457def0faa12e3f6cf58be0e9c69e6f5 Mon Sep 17 00:00:00 2001 From: dwigton Date: Mon, 15 Jul 2024 12:05:09 -0500 Subject: Apply suggestions from code review Co-authored-by: Michael J <37635304+buttercat1791@users.noreply.github.com> --- src/nostr_service.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/nostr_service.cpp') diff --git a/src/nostr_service.cpp b/src/nostr_service.cpp index 2c1f9a8..73cd602 100644 --- a/src/nostr_service.cpp +++ b/src/nostr_service.cpp @@ -183,9 +183,9 @@ tuple, vector> NostrService::publishEvent(shared_ptr>> NostrService::queryRelays(shared_ptr filters) +future>> NostrService::queryRelays(shared_ptr filters) { - return std::async(std::launch::async, [this, filters]() -> vector> + return async(launch::async, [this, filters]() -> vector> { if (filters->limit > 64 || filters->limit < 1) { @@ -267,20 +267,20 @@ std::future>> NostrService::queryRelays(shared_ptrcloseRelayConnections({ relay }); - } - } - this->closeSubscription(subscriptionId); + for (auto& publishFuture : requestFutures) + { + auto [relay, isEose] = publishFuture.get(); + if (isEose) + { + PLOG_INFO << "Received EOSE message from relay " << relay; + } + else + { + PLOG_WARNING << "Received CLOSE message from relay " << relay; + this->closeRelayConnections({ relay }); + } + } + this->closeSubscription(subscriptionId); return events; }); -- cgit