From 8fee82b0d62d1b805abdedeef4907acbfcbdd275 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 28 Feb 2019 18:28:45 -0800 Subject: [PATCH] modules/client/sync: Readd the transaction_id on longpoll; fix ghost events. --- include/ircd/m/sync.h | 1 + modules/client/sync.cc | 5 +++++ modules/client/sync/rooms/timeline.cc | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/include/ircd/m/sync.h b/include/ircd/m/sync.h index 0a963e951..e1c0c6a27 100644 --- a/include/ircd/m/sync.h +++ b/include/ircd/m/sync.h @@ -97,6 +97,7 @@ struct ircd::m::sync::data string_view membership; event::idx room_head {0}; // if *room event::idx event_idx {0}; // if *event + string_view client_txnid; data(const m::user &user, const m::events::range &range, diff --git a/modules/client/sync.cc b/modules/client/sync.cc index e13dfe157..d085ded17 100644 --- a/modules/client/sync.cc +++ b/modules/client/sync.cc @@ -567,6 +567,11 @@ ircd::m::sync::longpoll::handle(data &data, data.event_idx, event.event_idx }; + const scope_restore client_txnid + { + data.client_txnid, event.client_txnid + }; + json::stack::checkpoint checkpoint { *data.out diff --git a/modules/client/sync/rooms/timeline.cc b/modules/client/sync/rooms/timeline.cc index a869b114b..d011af14b 100644 --- a/modules/client/sync/rooms/timeline.cc +++ b/modules/client/sync/rooms/timeline.cc @@ -169,4 +169,10 @@ ircd::m::sync::_room_timeline_append(data &data, long(vm::current_sequence - event_idx) } }; + + if(data.client_txnid) + json::stack::member + { + unsigned_, "transaction_id", data.client_txnid + }; }