mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 16:34:13 +01:00
modules/client/sync: Add event_idx to accept struct; move top object construction to handlers.
This commit is contained in:
parent
85cae708db
commit
f91f6226a6
2 changed files with 32 additions and 11 deletions
|
@ -129,11 +129,6 @@ ircd::m::sync::handle_get(client &client,
|
|||
log, "request %s", loghead(data)
|
||||
};
|
||||
|
||||
json::stack::object object
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
const bool shortpolled
|
||||
{
|
||||
range.first > range.second?
|
||||
|
@ -159,6 +154,11 @@ ircd::m::sync::handle_get(client &client,
|
|||
void
|
||||
ircd::m::sync::empty_response(data &data)
|
||||
{
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
// Empty objects added to output otherwise Riot b0rks.
|
||||
json::stack::object
|
||||
{
|
||||
|
@ -222,6 +222,11 @@ try
|
|||
*data.out
|
||||
};
|
||||
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
bool ret{false};
|
||||
m::sync::for_each(string_view{}, [&data, &ret]
|
||||
(item &item)
|
||||
|
@ -308,6 +313,11 @@ try
|
|||
*data.out
|
||||
};
|
||||
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
const unique_buffer<mutable_buffer> buf
|
||||
{
|
||||
96_KiB //TODO: XXX
|
||||
|
@ -420,7 +430,18 @@ ircd::m::sync::linear_proffer_event(data &data,
|
|||
data.out, &out
|
||||
};
|
||||
|
||||
return linear_proffer_event_one(data)?
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
const bool success
|
||||
{
|
||||
linear_proffer_event_one(data)
|
||||
};
|
||||
|
||||
top.~object();
|
||||
return success?
|
||||
size(out.completed()):
|
||||
0UL;
|
||||
}
|
||||
|
@ -430,11 +451,6 @@ ircd::m::sync::linear_proffer_event(data &data,
|
|||
bool
|
||||
ircd::m::sync::linear_proffer_event_one(data &data)
|
||||
{
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
return !m::sync::for_each(string_view{}, [&data]
|
||||
(item &item)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace ircd::m::sync::longpoll
|
|||
{
|
||||
json::strung strung;
|
||||
std::string client_txnid;
|
||||
event::idx event_idx;
|
||||
|
||||
accepted(const m::vm::eval &eval)
|
||||
:strung
|
||||
|
@ -49,6 +50,10 @@ namespace ircd::m::sync::longpoll
|
|||
eval.copts->client_txnid:
|
||||
string_view{}
|
||||
}
|
||||
,event_idx
|
||||
{
|
||||
eval.sequence
|
||||
}
|
||||
{
|
||||
const json::object object{this->strung};
|
||||
static_cast<m::event &>(*this) = m::event{object};
|
||||
|
|
Loading…
Reference in a new issue