mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
modules/client/sync: Implement longpoll sync handler.
This commit is contained in:
parent
902466450e
commit
c88d961ad4
1 changed files with 45 additions and 1 deletions
|
@ -534,7 +534,51 @@ ircd::m::sync::longpoll::handle(data &data,
|
|||
const args &args,
|
||||
const accepted &event)
|
||||
{
|
||||
return false;
|
||||
const scope_restore their_event
|
||||
{
|
||||
data.event, &event
|
||||
};
|
||||
|
||||
const scope_restore their_event_idx
|
||||
{
|
||||
data.event_idx, event.event_idx
|
||||
};
|
||||
|
||||
json::stack::checkpoint checkpoint
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
json::stack::object top
|
||||
{
|
||||
*data.out
|
||||
};
|
||||
|
||||
const bool ret
|
||||
{
|
||||
linear_proffer_event_one(data)
|
||||
};
|
||||
|
||||
if(ret)
|
||||
{
|
||||
json::stack::member
|
||||
{
|
||||
*data.out, "next_batch", json::value
|
||||
{
|
||||
lex_cast(event.event_idx + 1), json::STRING
|
||||
}
|
||||
};
|
||||
|
||||
log::debug
|
||||
{
|
||||
log, "longpoll %s idx:%lu complete",
|
||||
loghead(data),
|
||||
event.event_idx
|
||||
};
|
||||
}
|
||||
else checkpoint.rollback();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue