From 63a238fa761247cb4dfbe4fac284aa91bb0ae1b1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 13 Jul 2019 19:27:42 -0700 Subject: [PATCH] modules/federation/sender: Fix event_id regression. --- modules/federation/sender.cc | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/modules/federation/sender.cc b/modules/federation/sender.cc index b81619381..313a07e0b 100644 --- a/modules/federation/sender.cc +++ b/modules/federation/sender.cc @@ -10,7 +10,6 @@ #include "sender.int.h" - std::list txns; std::map> nodes; @@ -54,7 +53,7 @@ IRCD_MODULE } }; -std::deque +std::deque> notified_queue; ctx::dock @@ -80,7 +79,14 @@ handle_notify(const m::event &event, if(!eval.opts->notify_servers) return; - notified_queue.emplace_back(json::strung{event}); + const m::event::id::buf &event_id + { + event.event_id? + m::event::id::buf{event.event_id}: + m::event::id::buf{} + }; + + notified_queue.emplace_back(json::strung{event}, event_id); notified_dock.notify_all(); } @@ -101,9 +107,14 @@ send_worker() notified_queue.pop_front(); }}; + const auto &[event_, event_id] + { + notified_queue.front() + }; + const m::event event { - json::object{notified_queue.front()} + json::object{event_}, event_id }; send(event); @@ -268,6 +279,15 @@ try const unwind::nominal::assertion na; curtxn = &txns.back(); q.clear(); + log::debug + { + m::log, "sending txn %s pdus:%zu edus:%zu to '%s'", + curtxn->txnid, + pdus, + edus, + this->remote, + }; + recv_action.notify_one(); return true; }