X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FServer.cc;h=40b4d8059578cb51bfe133d1f2a92e72e5289732;hb=ecb47e13433d59c79a74a4641a2e68648f142723;hp=8eb41acae0b6e04a6cc528feceedeabd5ec22bd2;hpb=80550046686fc160f5d7ff076f1b167a13538466;p=senf.git diff --git a/senf/Utils/Console/Server.cc b/senf/Utils/Console/Server.cc index 8eb41ac..40b4d80 100644 --- a/senf/Utils/Console/Server.cc +++ b/senf/Utils/Console/Server.cc @@ -173,7 +173,7 @@ prefix_ void senf::console::detail::DumbClientReader::showPrompt() prompt += " "; stream() << std::flush; - handle().write(prompt); + v_write(prompt); promptLen_ = prompt.size(); promptActive_ = true; } @@ -194,7 +194,17 @@ prefix_ void senf::console::detail::DumbClientReader::v_enablePrompt() prefix_ void senf::console::detail::DumbClientReader::v_write(std::string const & data) { - handle().write(data); + try { + handle().write(data); + } + catch (std::exception & ex) { + SENF_LOG(("unexpected failure writing to socket:" << ex.what())); + stopClient(); // SUICIDE + } + catch (...) { + SENF_LOG(("unexpected failure writing to socket: unknown exception")); + stopClient(); // SUICIDE + } } prefix_ unsigned senf::console::detail::DumbClientReader::v_width() @@ -222,7 +232,17 @@ prefix_ void senf::console::detail::NoninteractiveClientReader::v_enablePrompt() prefix_ void senf::console::detail::NoninteractiveClientReader::v_write(std::string const & data) { - handle().write(data); + try { + handle().write(data); + } + catch (std::exception & ex) { + SENF_LOG(("unexpected failure writing to socket:" << ex.what())); + stopClient(); // SUICIDE + } + catch (...) { + SENF_LOG(("unexpected failure writing to socket: unknown exception")); + stopClient(); // SUICIDE + } } prefix_ unsigned senf::console::detail::NoninteractiveClientReader::v_width()