From 2a2c05e6418f7aa2a474d4db7d80ba26decd8774 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 16 Mar 2018 20:41:40 -0700 Subject: [PATCH] ircd::client: Handle exceptions below main. --- ircd/client.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ircd/client.cc b/ircd/client.cc index c9babd35e..b402571cc 100644 --- a/ircd/client.cc +++ b/ircd/client.cc @@ -250,7 +250,7 @@ namespace ircd static bool handle_ec_eof(client &); static bool handle_ec(client &, const error_code &); - static void handle_client_request(std::shared_ptr); + static void handle_client_request(std::shared_ptr) noexcept; static void handle_client_ready(std::shared_ptr, const error_code &ec); } @@ -326,14 +326,22 @@ ircd::handle_client_ready(std::shared_ptr client, /// or die. void ircd::handle_client_request(std::shared_ptr client) +noexcept try { - if(!client->main()) - { + if(client->main()) + client->async(); + else client->close(net::dc::SSL_NOTIFY).wait(); - return; - } - - client->async(); +} +catch(const std::exception &e) +{ + log::derror + { + "socket(%p) client(%p) (below main): %s", + client->sock.get(), + client.get(), + e.what() + }; } /// This error handling switch is one of two places client errors