Do not throw an exception when recv returns and error, just close the socket

This commit is contained in:
Florent Le Coz
2014-01-04 01:59:36 +01:00
parent acf769d83a
commit baf03a7e20
+5 -1
View File
@@ -75,7 +75,11 @@ void SocketHandler::on_recv(const size_t nb)
this->close(); this->close();
} }
else if (-1 == static_cast<ssize_t>(size)) 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 else
{ {
this->in_buf += std::string(buf, size); this->in_buf += std::string(buf, size);