0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd: Simplify this service stack for now.

This commit is contained in:
Jason Volk 2017-09-12 10:04:40 -07:00
parent 214e5e7107
commit 6503d28006
2 changed files with 18 additions and 35 deletions

View file

@ -57,7 +57,6 @@ struct ircd::client
unique_const_iterator<list> clit;
std::shared_ptr<socket> sock;
virtual bool serve();
bool main() noexcept;
public:

View file

@ -243,11 +243,28 @@ noexcept
{
}
namespace ircd
{
void handle_request(client &client, parse::capstan &pc, const http::request::head &head);
bool handle_request(client &client, parse::capstan &pc);
}
bool
ircd::client::main()
noexcept try
{
return serve();
char buffer[8192];
parse::buffer pb{buffer, buffer + sizeof(buffer)};
parse::capstan pc{pb, read_closure(*this)}; do
{
if(!handle_request(*this, pc))
return false;
pb.remove();
}
while(pc.unparsed());
return true;
}
catch(const boost::system::system_error &e)
{
@ -280,39 +297,6 @@ catch(const boost::system::system_error &e)
return false;
}
catch(const std::exception &e)
{
log::critical("exception: %s", e.what());
if(ircd::debugmode)
std::terminate();
return false;
}
namespace ircd
{
void handle_request(client &client, parse::capstan &pc, const http::request::head &head);
bool handle_request(client &client, parse::capstan &pc);
} // namepace ircd
bool
ircd::client::serve()
try
{
char buffer[8192];
parse::buffer pb{buffer, buffer + sizeof(buffer)};
parse::capstan pc{pb, read_closure(*this)}; do
{
if(!handle_request(*this, pc))
return false;
pb.remove();
}
while(pc.unparsed());
return true;
}
catch(const ircd::exception &e)
{
log::error("client[%s] [500 Internal Error]: %s",
string(remote_addr(*this)),