mirror of
https://github.com/matrix-construct/construct
synced 2024-10-06 07:38:52 +02:00
modules/client/sync: Reorg / deinline sync args related.
This commit is contained in:
parent
a30c808b0e
commit
80b3cd678e
2 changed files with 47 additions and 41 deletions
|
@ -35,27 +35,6 @@ on the server, and then continue to call this API to get incremental deltas
|
||||||
to the state, and to receive new messages.
|
to the state, and to receive new messages.
|
||||||
)"};
|
)"};
|
||||||
|
|
||||||
ircd::conf::item<ircd::milliseconds>
|
|
||||||
ircd::m::sync::args::timeout_max
|
|
||||||
{
|
|
||||||
{ "name", "ircd.client.sync.timeout.max" },
|
|
||||||
{ "default", 15 * 1000L },
|
|
||||||
};
|
|
||||||
|
|
||||||
ircd::conf::item<ircd::milliseconds>
|
|
||||||
ircd::m::sync::args::timeout_min
|
|
||||||
{
|
|
||||||
{ "name", "ircd.client.sync.timeout.min" },
|
|
||||||
{ "default", 5 * 1000L },
|
|
||||||
};
|
|
||||||
|
|
||||||
ircd::conf::item<ircd::milliseconds>
|
|
||||||
ircd::m::sync::args::timeout_default
|
|
||||||
{
|
|
||||||
{ "name", "ircd.client.sync.timeout.default" },
|
|
||||||
{ "default", 10 * 1000L },
|
|
||||||
};
|
|
||||||
|
|
||||||
decltype(ircd::m::sync::flush_hiwat)
|
decltype(ircd::m::sync::flush_hiwat)
|
||||||
ircd::m::sync::flush_hiwat
|
ircd::m::sync::flush_hiwat
|
||||||
{
|
{
|
||||||
|
@ -402,3 +381,48 @@ ircd::m::sync::longpoll::handle(data &data,
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sync/args.h
|
||||||
|
//
|
||||||
|
|
||||||
|
ircd::conf::item<ircd::milliseconds>
|
||||||
|
ircd::m::sync::args::timeout_max
|
||||||
|
{
|
||||||
|
{ "name", "ircd.client.sync.timeout.max" },
|
||||||
|
{ "default", 15 * 1000L },
|
||||||
|
};
|
||||||
|
|
||||||
|
ircd::conf::item<ircd::milliseconds>
|
||||||
|
ircd::m::sync::args::timeout_min
|
||||||
|
{
|
||||||
|
{ "name", "ircd.client.sync.timeout.min" },
|
||||||
|
{ "default", 5 * 1000L },
|
||||||
|
};
|
||||||
|
|
||||||
|
ircd::conf::item<ircd::milliseconds>
|
||||||
|
ircd::m::sync::args::timeout_default
|
||||||
|
{
|
||||||
|
{ "name", "ircd.client.sync.timeout.default" },
|
||||||
|
{ "default", 10 * 1000L },
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// args::args
|
||||||
|
//
|
||||||
|
|
||||||
|
ircd::m::sync::args::args(const resource::request &request)
|
||||||
|
try
|
||||||
|
:request
|
||||||
|
{
|
||||||
|
request
|
||||||
|
}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(const bad_lex_cast &e)
|
||||||
|
{
|
||||||
|
throw m::BAD_REQUEST
|
||||||
|
{
|
||||||
|
"Since parameter invalid :%s", e.what()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -77,11 +77,8 @@ namespace ircd::m::sync::polylog
|
||||||
static bool handle(data &);
|
static bool handle(data &);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Argument parser for the client's /sync request
|
|
||||||
struct ircd::m::sync::args
|
struct ircd::m::sync::args
|
||||||
{
|
{
|
||||||
args(const resource::request &request);
|
|
||||||
|
|
||||||
static conf::item<milliseconds> timeout_max;
|
static conf::item<milliseconds> timeout_max;
|
||||||
static conf::item<milliseconds> timeout_min;
|
static conf::item<milliseconds> timeout_min;
|
||||||
static conf::item<milliseconds> timeout_default;
|
static conf::item<milliseconds> timeout_default;
|
||||||
|
@ -132,21 +129,6 @@ struct ircd::m::sync::args
|
||||||
// marked as being online when it uses this API. One of: ["offline"]
|
// marked as being online when it uses this API. One of: ["offline"]
|
||||||
request.query.get("set_presence", true)
|
request.query.get("set_presence", true)
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
inline
|
args(const resource::request &request);
|
||||||
ircd::m::sync::args::args(const resource::request &request)
|
};
|
||||||
try
|
|
||||||
:request
|
|
||||||
{
|
|
||||||
request
|
|
||||||
}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch(const bad_lex_cast &e)
|
|
||||||
{
|
|
||||||
throw m::BAD_REQUEST
|
|
||||||
{
|
|
||||||
"Since parameter invalid :%s", e.what()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue