summaryrefslogtreecommitdiff
path: root/src/network/socket_handler.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-29 19:59:50 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commitbaf03a7e20d30698a06ccf03cd93b15317de340e (patch)
tree3f433b39fa37eef7f3157fe79f317ee8fabaad96 /src/network/socket_handler.cpp
parentacf769d83a40e971ccc1346225688841465b36ee (diff)
downloadbiboumi-baf03a7e20d30698a06ccf03cd93b15317de340e.tar.gz
biboumi-baf03a7e20d30698a06ccf03cd93b15317de340e.tar.bz2
biboumi-baf03a7e20d30698a06ccf03cd93b15317de340e.tar.xz
biboumi-baf03a7e20d30698a06ccf03cd93b15317de340e.zip
Do not throw an exception when recv returns and error, just close the socket
Diffstat (limited to 'src/network/socket_handler.cpp')
-rw-r--r--src/network/socket_handler.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp
index 484aa8f..4dab214 100644
--- a/src/network/socket_handler.cpp
+++ b/src/network/socket_handler.cpp
@@ -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);