0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 05:58:56 +02:00

ircd:Ⓜ️:v1: Add convenience option for dynamic memory to all requests.

This commit is contained in:
Jason Volk 2018-04-06 00:21:32 -07:00
parent d3e6b20f14
commit 13c4a5b79b
12 changed files with 44 additions and 11 deletions

View file

@ -40,4 +40,5 @@ struct ircd::m::v1::backfill::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {true};
};

View file

@ -45,4 +45,5 @@ struct ircd::m::v1::event::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};

View file

@ -37,4 +37,5 @@ struct ircd::m::v1::groups::publicised::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};

View file

@ -37,4 +37,5 @@ struct ircd::m::v1::invite::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};

View file

@ -38,4 +38,5 @@ struct ircd::m::v1::make_join::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};

View file

@ -42,6 +42,7 @@ struct ircd::m::v1::query::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
opts(const net::hostport &remote)
:remote{remote}

View file

@ -64,6 +64,7 @@ struct ircd::m::v1::send::opts
/// The lower-level server::request::opts configuration to attach to
/// this request.
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};
/// Helper for dealing with response content from a /send/.

View file

@ -37,4 +37,5 @@ struct ircd::m::v1::send_join::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {true};
};

View file

@ -40,4 +40,5 @@ struct ircd::m::v1::state::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {true};
};

View file

@ -39,6 +39,7 @@ struct ircd::m::v1::user::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
opts(const net::hostport &remote)
:remote{remote}

View file

@ -37,4 +37,5 @@ struct ircd::m::v1::version::opts
server::out out;
server::in in;
const struct server::request::opts *sopts {nullptr};
bool dynamic {false};
};

View file

@ -55,7 +55,9 @@ ircd::m::v1::groups::publicised::publicised(const id::node &node,
{
consume(buf, size(opts.out.head));
opts.in.head = buf;
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -124,7 +126,9 @@ ircd::m::v1::send::send(const string_view &txnid,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -197,7 +201,9 @@ ircd::m::v1::backfill::backfill(const room::id &room_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -270,7 +276,9 @@ ircd::m::v1::state::state(const room::id &room_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -331,7 +339,9 @@ ircd::m::v1::event::event(const m::event::id &event_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -385,7 +395,9 @@ ircd::m::v1::invite::invite(const room::id &room_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -439,7 +451,9 @@ ircd::m::v1::send_join::send_join(const room::id &room_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -503,7 +517,9 @@ ircd::m::v1::make_join::make_join(const room::id &room_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -554,7 +570,9 @@ ircd::m::v1::user::devices::devices(const id::user &user_id,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -762,7 +780,9 @@ ircd::m::v1::query::query(const string_view &type,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request
@ -799,7 +819,9 @@ ircd::m::v1::version::version(const mutable_buffer &buf,
if(!size(opts.in))
{
opts.in.head = buf + size(opts.out.head);
opts.in.content = opts.in.head; // server::request will auto partition
opts.in.content = opts.dynamic?
mutable_buffer{}: // server::request will allocate new mem
opts.in.head; // server::request will auto partition
}
return server::request