0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

modules/client/sync: Handle timeout from acceptor dock.

This commit is contained in:
Jason Volk 2018-04-22 21:54:06 -07:00
parent a5ebd50f55
commit 18e9c792be

View file

@ -322,6 +322,7 @@ void
longpoll_sync(client &client,
const resource::request &request,
const syncargs &args)
try
{
std::unique_lock<decltype(m::vm::accept)> lock
{
@ -332,8 +333,7 @@ longpoll_sync(client &client,
{
auto &accepted
{
//m::vm::accept.wait_for(lock, milliseconds(sync_timeout_min))
m::vm::accept.wait(lock)
m::vm::accept.wait_until(lock, args.timesout)
};
const unlock_guard<decltype(lock)> ul(lock);
@ -341,6 +341,25 @@ longpoll_sync(client &client,
return;
}
}
catch(const ctx::timeout &e)
{
const ctx::exception_handler eh;
const int64_t &since
{
int64_t(m::vm::current_sequence)
};
resource::response
{
client, json::members
{
{ "next_batch", int64_t(since) },
{ "rooms", json::object{} },
{ "presence", json::object{} },
}
};
}
static bool
synchronize(client &client,