~singpolyma/biboumi

baf03a7e20d30698a06ccf03cd93b15317de340e — Florent Le Coz 9 years ago acf769d
Do not throw an exception when recv returns and error, just close the socket
1 files changed, 5 insertions(+), 1 deletions(-)

M src/network/socket_handler.cpp
M src/network/socket_handler.cpp => src/network/socket_handler.cpp +5 -1
@@ 75,7 75,11 @@ void SocketHandler::on_recv(const size_t nb)
      this->close();
    }
  else if (-1 == static_cast<ssize_t>(size))
    throw std::runtime_error("Error reading from socket");
    {
      log_warning("Error while reading from socket: " << strerror(errno));
      this->on_connection_close();
      this->close();
    }
  else
    {
      this->in_buf += std::string(buf, size);