mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd: Remove cruft.
This commit is contained in:
parent
e3963da007
commit
b9f13ed2c2
3 changed files with 36 additions and 65 deletions
|
@ -33,7 +33,6 @@ namespace ircd
|
|||
|
||||
const char *write(client &, const char *&start, const char *const &stop);
|
||||
char *read(client &, char *&start, char *const &stop);
|
||||
string_view readline(client &, char *&start, char *const &stop);
|
||||
|
||||
http::response::write_closure write_closure(client &);
|
||||
parse::read_closure read_closure(client &);
|
||||
|
|
|
@ -87,63 +87,6 @@ noexcept
|
|||
request.join();
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::readline(client &client,
|
||||
char *&start,
|
||||
char *const &stop)
|
||||
{
|
||||
auto &sock(*client.sock);
|
||||
|
||||
size_t pos;
|
||||
string_view ret;
|
||||
char *const base(start); do
|
||||
{
|
||||
const std::array<mutable_buffer, 1> bufs
|
||||
{{
|
||||
{ start, stop }
|
||||
}};
|
||||
|
||||
start += sock.read_some(bufs);
|
||||
ret = {base, start};
|
||||
pos = ret.find("\r\n");
|
||||
}
|
||||
while(pos != std::string_view::npos);
|
||||
|
||||
return { begin(ret), std::next(begin(ret), pos + 2) };
|
||||
}
|
||||
|
||||
char *
|
||||
ircd::read(client &client,
|
||||
char *&start,
|
||||
char *const &stop)
|
||||
{
|
||||
auto &sock(*client.sock);
|
||||
const std::array<mutable_buffer, 1> bufs
|
||||
{{
|
||||
{ start, stop }
|
||||
}};
|
||||
|
||||
char *const base(start);
|
||||
start += sock.read_some(bufs);
|
||||
return base;
|
||||
}
|
||||
|
||||
const char *
|
||||
ircd::write(client &client,
|
||||
const char *&start,
|
||||
const char *const &stop)
|
||||
{
|
||||
auto &sock(*client.sock);
|
||||
const std::array<const_buffer, 1> bufs
|
||||
{{
|
||||
{ start, stop }
|
||||
}};
|
||||
|
||||
const char *const base(start);
|
||||
start += sock.write(bufs);
|
||||
return base;
|
||||
}
|
||||
|
||||
ircd::hostport
|
||||
ircd::local(const client &client)
|
||||
{
|
||||
|
@ -211,6 +154,42 @@ ircd::read_closure(client &client)
|
|||
};
|
||||
}
|
||||
|
||||
char *
|
||||
ircd::read(client &client,
|
||||
char *&start,
|
||||
char *const &stop)
|
||||
{
|
||||
auto &sock(*client.sock);
|
||||
const std::array<mutable_buffer, 1> bufs
|
||||
{{
|
||||
{ start, stop }
|
||||
}};
|
||||
|
||||
char *const base(start);
|
||||
start += sock.read_some(bufs);
|
||||
return base;
|
||||
}
|
||||
|
||||
const char *
|
||||
ircd::write(client &client,
|
||||
const char *&start,
|
||||
const char *const &stop)
|
||||
{
|
||||
auto &sock(*client.sock);
|
||||
const std::array<const_buffer, 1> bufs
|
||||
{{
|
||||
{ start, stop }
|
||||
}};
|
||||
|
||||
const char *const base(start);
|
||||
start += sock.write(bufs);
|
||||
return base;
|
||||
}
|
||||
|
||||
//
|
||||
// client
|
||||
//
|
||||
|
||||
ircd::client::client()
|
||||
:client{std::shared_ptr<socket>{}}
|
||||
{
|
||||
|
|
|
@ -578,13 +578,6 @@ initial_sync(client &client,
|
|||
const bool &full_state,
|
||||
const string_view &set_presence)
|
||||
{
|
||||
char buf[4096] {0};
|
||||
json::mutable_object body{buf};
|
||||
body.insert({"foo","bar"});
|
||||
body.insert({"baz","bam"});
|
||||
|
||||
std::cout << buf << std::endl;
|
||||
|
||||
const std::string rooms
|
||||
{
|
||||
initial_sync_rooms(client, request, filter_id, full_state)
|
||||
|
|
Loading…
Reference in a new issue