X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FServer.cc;h=a1bad60e45e27a1a2b53e43b9e1e77e93fb57951;hb=d5a72d0b3f6fee56dba6de1c54cafb448ebe3457;hp=58a3dcc0fd9ce5e7668ec9cf2069dc23962ea1e5;hpb=731a143df4de38d4c8b0a81121990951971cd858;p=senf.git diff --git a/Utils/Console/Server.cc b/Utils/Console/Server.cc index 58a3dcc..a1bad60 100644 --- a/Utils/Console/Server.cc +++ b/Utils/Console/Server.cc @@ -111,7 +111,15 @@ prefix_ void senf::console::Server::newClient(int event) prefix_ void senf::console::Server::removeClient(Client & client) { - SENF_LOG(( "Disposing client " << client.handle().peer() )); + SENF_LOG_BLOCK(({ + log << "Disposing client "; + try { + log << client.handle().peer(); + } + catch (senf::SystemException ex) { + log << "(unknown)"; + } + })); // THIS DELETES THE CLIENT INSTANCE !! clients_.erase(boost::intrusive_ptr(&client)); } @@ -284,12 +292,6 @@ prefix_ void senf::console::Client::setNoninteractive() prefix_ std::string::size_type senf::console::Client::handleInput(std::string data, bool incremental) { - if (data.empty() && ! incremental) { - data = lastCommand_; - stream() << "repeat: " << data << std::endl; - } else - lastCommand_ = data; - std::string::size_type n (data.size()); try { @@ -336,6 +338,17 @@ prefix_ void senf::console::Client::v_write(senf::log::time_type timestamp, reader_->enablePrompt(); } +prefix_ unsigned senf::console::Client::getWidth(std::ostream & os, unsigned defaultWidth, + unsigned minWidth) +{ + unsigned rv (defaultWidth); + try { + rv = get(os).width(); + } + catch (std::bad_cast &) {} + return rv < minWidth ? defaultWidth : rv; +} + /////////////////////////////////////////////////////////////////////////// // senf::console::Client::SysBacktrace