mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 19:33:45 +02:00
Rename common instance variables of window_buffer for clarity.
This commit is contained in:
parent
ef32565d66
commit
3d672ab9bc
|
@ -35,7 +35,7 @@ struct ircd::m::bridge::query
|
|||
rfc3986::uri base_url;
|
||||
unique_mutable_buffer buf;
|
||||
string_view uri;
|
||||
window_buffer wb;
|
||||
window_buffer window;
|
||||
http::request hypertext;
|
||||
server::request::opts sopts;
|
||||
server::request request;
|
||||
|
|
|
@ -84,10 +84,10 @@ ircd::string_view
|
|||
ircd::fpe::reflect(const mutable_buffer &buf,
|
||||
const ushort &flags)
|
||||
{
|
||||
window_buffer wb{buf};
|
||||
const auto append{[&wb](const auto &flag)
|
||||
window_buffer window{buf};
|
||||
const auto append{[&window](const auto &flag)
|
||||
{
|
||||
wb([&flag](const mutable_buffer &buf)
|
||||
window([&flag](const mutable_buffer &buf)
|
||||
{
|
||||
return strlcpy(buf, reflect(flag));
|
||||
});
|
||||
|
@ -97,7 +97,7 @@ ircd::fpe::reflect(const mutable_buffer &buf,
|
|||
if(flags & (1 << i))
|
||||
append(1 << i);
|
||||
|
||||
return wb.completed();
|
||||
return window.completed();
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
|
|
12
ircd/http.cc
12
ircd/http.cc
|
@ -920,11 +920,11 @@ const
|
|||
return {};
|
||||
|
||||
size_t ret(0);
|
||||
window_buffer wb(buf);
|
||||
for_each(key, [&out, &max, &ret, &wb]
|
||||
window_buffer window(buf);
|
||||
for_each(key, [&out, &max, &ret, &window]
|
||||
(const auto &query)
|
||||
{
|
||||
wb([&out, &max, &ret, &query]
|
||||
window([&out, &max, &ret, &query]
|
||||
(const mutable_buffer &buf)
|
||||
{
|
||||
assert(ret < max);
|
||||
|
@ -1074,9 +1074,9 @@ ircd::const_buffer
|
|||
ircd::http::writechunk(const mutable_buffer &buf,
|
||||
const uint32_t &chunk_size)
|
||||
{
|
||||
window_buffer wb{buf};
|
||||
writechunk(wb, chunk_size);
|
||||
return wb.completed();
|
||||
window_buffer window{buf};
|
||||
writechunk(window, chunk_size);
|
||||
return window.completed();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -145,13 +145,13 @@ ircd::m::bridge::query::query(const config &config,
|
|||
{
|
||||
uri
|
||||
}
|
||||
,wb
|
||||
,window
|
||||
{
|
||||
buf
|
||||
}
|
||||
,hypertext
|
||||
{
|
||||
wb,
|
||||
window,
|
||||
base_url.remote,
|
||||
"GET",
|
||||
uri,
|
||||
|
@ -162,9 +162,22 @@ ircd::m::bridge::query::query(const config &config,
|
|||
}
|
||||
,request
|
||||
{
|
||||
net::hostport { base_url.remote },
|
||||
server::out { wb.completed(), {} },
|
||||
server::in { wb.remains(), !empty(in_body)? in_body: wb.remains() },
|
||||
net::hostport
|
||||
{
|
||||
base_url.remote
|
||||
},
|
||||
server::out
|
||||
{
|
||||
window.completed(),
|
||||
{}
|
||||
},
|
||||
server::in
|
||||
{
|
||||
window.remains(),
|
||||
empty(in_body)?
|
||||
window.remains():
|
||||
in_body
|
||||
},
|
||||
&sopts,
|
||||
}
|
||||
,code
|
||||
|
|
|
@ -560,18 +560,18 @@ ircd::m::fed::well_known::submit(request &req)
|
|||
{ "User-Agent", info::user_agent },
|
||||
};
|
||||
|
||||
window_buffer wb
|
||||
window_buffer window
|
||||
{
|
||||
req.buf
|
||||
};
|
||||
|
||||
http::request
|
||||
{
|
||||
wb, host(target), "GET", req.uri.path, 0, {}, headers
|
||||
window, host(target), "GET", req.uri.path, 0, {}, headers
|
||||
};
|
||||
|
||||
server::out out;
|
||||
out.head = wb.completed();
|
||||
out.head = window.completed();
|
||||
|
||||
// Remaining space in buffer is used for received head; note that below
|
||||
// we specify this same buffer for in.content, but that's a trick
|
||||
|
|
|
@ -816,15 +816,15 @@ try
|
|||
std::max(size_t(linear_buffer_size), size_t(128_KiB))
|
||||
};
|
||||
|
||||
window_buffer wb{buf};
|
||||
window_buffer window{buf};
|
||||
const auto &[last, completed]
|
||||
{
|
||||
linear_proffer(data, wb)
|
||||
linear_proffer(data, window)
|
||||
};
|
||||
|
||||
const json::vector vector
|
||||
{
|
||||
wb.completed()
|
||||
window.completed()
|
||||
};
|
||||
|
||||
const auto next
|
||||
|
@ -895,10 +895,10 @@ catch(const std::exception &e)
|
|||
/// to our client in the event iteration.
|
||||
std::pair<ircd::m::event::idx, bool>
|
||||
ircd::m::sync::linear_proffer(data &data,
|
||||
window_buffer &wb)
|
||||
window_buffer &window)
|
||||
{
|
||||
event::idx ret(0);
|
||||
const auto closure{[&data, &wb, &ret]
|
||||
const auto closure{[&data, &window, &ret]
|
||||
(const m::event::idx &event_idx, const m::event &event)
|
||||
{
|
||||
assert(event_idx <= m::vm::sequence::retired);
|
||||
|
@ -912,7 +912,7 @@ ircd::m::sync::linear_proffer(data &data,
|
|||
data.event_idx, event_idx
|
||||
};
|
||||
|
||||
wb([&data, &ret, &event_idx]
|
||||
window([&data, &ret, &event_idx]
|
||||
(const mutable_buffer &buf)
|
||||
{
|
||||
const auto consumed
|
||||
|
@ -931,7 +931,7 @@ ircd::m::sync::linear_proffer(data &data,
|
|||
// The buffer must have at least this much more space
|
||||
// to continue with the iteration. Otherwise if the next
|
||||
// worst-case event does not fit, bad things.
|
||||
wb.remaining() >= 68_KiB
|
||||
window.remaining() >= 68_KiB
|
||||
|
||||
// When the handler reports this special-case we have
|
||||
// to stop at this iteration.
|
||||
|
|
|
@ -16448,17 +16448,17 @@ console_cmd__mc__versions(opt &out, const string_view &line)
|
|||
16_KiB
|
||||
};
|
||||
|
||||
window_buffer wb{buf};
|
||||
window_buffer window{buf};
|
||||
http::request
|
||||
{
|
||||
wb, host(remote), "GET", "/_matrix/client/versions"
|
||||
window, host(remote), "GET", "/_matrix/client/versions"
|
||||
};
|
||||
|
||||
server::request request
|
||||
{
|
||||
remote,
|
||||
server::out { wb.completed() },
|
||||
server::in { mutable_buffer{wb} },
|
||||
server::out { window.completed() },
|
||||
server::in { mutable_buffer{window} },
|
||||
};
|
||||
|
||||
const auto code
|
||||
|
@ -16509,8 +16509,8 @@ console_cmd__mc__register(opt &out, const string_view &line)
|
|||
16_KiB
|
||||
};
|
||||
|
||||
window_buffer wb{buf};
|
||||
wb([&](mutable_buffer buf)
|
||||
window_buffer window{buf};
|
||||
window([&](mutable_buffer buf)
|
||||
{
|
||||
return json::stringify(buf, json::members
|
||||
{
|
||||
|
@ -16525,23 +16525,23 @@ console_cmd__mc__register(opt &out, const string_view &line)
|
|||
|
||||
const string_view &content
|
||||
{
|
||||
wb.completed()
|
||||
window.completed()
|
||||
};
|
||||
|
||||
wb = mutable_buffer{wb};
|
||||
window = mutable_buffer{window};
|
||||
http::request
|
||||
{
|
||||
wb, host(remote), "POST", uri, size(content), "application/json"
|
||||
window, host(remote), "POST", uri, size(content), "application/json"
|
||||
};
|
||||
|
||||
server::out sout
|
||||
{
|
||||
wb.completed(), content
|
||||
window.completed(), content
|
||||
};
|
||||
|
||||
server::in sin
|
||||
{
|
||||
mutable_buffer{wb}
|
||||
mutable_buffer{window}
|
||||
};
|
||||
|
||||
server::request request
|
||||
|
@ -16589,8 +16589,8 @@ console_cmd__mc__register__available(opt &out, const string_view &line)
|
|||
16_KiB
|
||||
};
|
||||
|
||||
window_buffer wb{buf};
|
||||
wb([&user_id](const mutable_buffer &buf)
|
||||
window_buffer window{buf};
|
||||
window([&user_id](const mutable_buffer &buf)
|
||||
{
|
||||
char urlencbuf[256];
|
||||
return fmt::sprintf
|
||||
|
@ -16600,15 +16600,15 @@ console_cmd__mc__register__available(opt &out, const string_view &line)
|
|||
};
|
||||
});
|
||||
|
||||
const string_view uri{wb.completed()};
|
||||
wb = mutable_buffer{wb};
|
||||
const string_view uri{window.completed()};
|
||||
window = mutable_buffer{window};
|
||||
http::request
|
||||
{
|
||||
wb, host(remote), "GET", uri
|
||||
window, host(remote), "GET", uri
|
||||
};
|
||||
|
||||
server::out sout{wb.completed()};
|
||||
server::in sin{mutable_buffer{wb}};
|
||||
server::out sout{window.completed()};
|
||||
server::in sin{mutable_buffer{window}};
|
||||
server::request request
|
||||
{
|
||||
remote, std::move(sout), std::move(sin)
|
||||
|
|
|
@ -340,12 +340,12 @@ ircd::m::push::notify_http(const m::user &user,
|
|||
std::make_unique<request>()
|
||||
};
|
||||
|
||||
window_buffer wb{req->buf};
|
||||
window_buffer window{req->buf};
|
||||
mutable_buffer buf{req->buf};
|
||||
req->event_idx = event.event_idx;
|
||||
|
||||
// Target URL copied to request and verified on assignment
|
||||
wb([&req, &pusher](const mutable_buffer &buf)
|
||||
window([&req, &pusher](const mutable_buffer &buf)
|
||||
{
|
||||
const json::object data
|
||||
{
|
||||
|
@ -360,11 +360,11 @@ ircd::m::push::notify_http(const m::user &user,
|
|||
req->url = url;
|
||||
return url;
|
||||
});
|
||||
consume(buf, wb.consumed());
|
||||
wb = window_buffer(wb.remains());
|
||||
consume(buf, window.consumed());
|
||||
window = window_buffer(window.remains());
|
||||
|
||||
// Compose request content
|
||||
wb([&](const mutable_buffer &buf)
|
||||
window([&](const mutable_buffer &buf)
|
||||
{
|
||||
json::stack out{buf};
|
||||
{
|
||||
|
@ -375,8 +375,8 @@ ircd::m::push::notify_http(const m::user &user,
|
|||
req->content = out.completed();
|
||||
return string_view{req->content};
|
||||
});
|
||||
consume(buf, wb.consumed());
|
||||
wb = window_buffer(wb.remains());
|
||||
consume(buf, window.consumed());
|
||||
window = window_buffer(window.remains());
|
||||
|
||||
const net::hostport target
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ ircd::m::push::notify_http(const m::user &user,
|
|||
// Compose request head
|
||||
http::request
|
||||
{
|
||||
wb,
|
||||
window,
|
||||
host(target),
|
||||
"POST",
|
||||
req->url.path,
|
||||
|
@ -396,8 +396,8 @@ ircd::m::push::notify_http(const m::user &user,
|
|||
|
||||
// Outputs
|
||||
server::out out;
|
||||
out.head = wb.completed();
|
||||
consume(buf, wb.consumed());
|
||||
out.head = window.completed();
|
||||
consume(buf, window.consumed());
|
||||
out.content = req->content;
|
||||
|
||||
// Inputs to remaining buffer
|
||||
|
|
|
@ -109,14 +109,14 @@ request_url(const string_view &urle)
|
|||
"Required elements are missing from the supplied URL."
|
||||
};
|
||||
|
||||
window_buffer wb
|
||||
window_buffer window
|
||||
{
|
||||
buf + size(url)
|
||||
};
|
||||
|
||||
http::request
|
||||
{
|
||||
wb, host(remote), "GET", uri.path, 0, {},
|
||||
window, host(remote), "GET", uri.path, 0, {},
|
||||
{
|
||||
{ "User-Agent", info::user_agent },
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ request_url(const string_view &urle)
|
|||
|
||||
const const_buffer out_head
|
||||
{
|
||||
wb.completed()
|
||||
window.completed()
|
||||
};
|
||||
|
||||
const mutable_buffer in_head
|
||||
|
|
Loading…
Reference in a new issue