summaryrefslogtreecommitdiff
path: root/louloulibs/network
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-12-01 16:09:21 +0100
committerFlorent Le Coz <louiz@louiz.org>2015-12-01 16:09:21 +0100
commit05a82b810f09d5cf3a0388fc4eeb523d33662c9c (patch)
tree642f46deb63dd0ad16d713430d39ed1e704c211f /louloulibs/network
parent241768836ddfb9e3609f987224cd821058fcc948 (diff)
downloadbiboumi-05a82b810f09d5cf3a0388fc4eeb523d33662c9c.tar.gz
biboumi-05a82b810f09d5cf3a0388fc4eeb523d33662c9c.tar.bz2
biboumi-05a82b810f09d5cf3a0388fc4eeb523d33662c9c.tar.xz
biboumi-05a82b810f09d5cf3a0388fc4eeb523d33662c9c.zip
Display a better error when connection fails
The error should not tell “while reading” when we are just connecting.
Diffstat (limited to 'louloulibs/network')
-rw-r--r--louloulibs/network/tcp_socket_handler.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/louloulibs/network/tcp_socket_handler.cpp b/louloulibs/network/tcp_socket_handler.cpp
index e6901c8..83863b0 100644
--- a/louloulibs/network/tcp_socket_handler.cpp
+++ b/louloulibs/network/tcp_socket_handler.cpp
@@ -266,7 +266,10 @@ ssize_t TCPSocketHandler::do_recv(void* recv_buf, const size_t buf_size)
}
else if (-1 == size)
{
- log_warning("Error while reading from socket: " << strerror(errno));
+ if (this->connecting)
+ log_warning("Error connecting: " << strerror(errno));
+ else
+ log_warning("Error while reading from socket: " << strerror(errno));
// Remember if we were connecting, or already connected when this
// happened, because close() sets this->connecting to false
const auto were_connecting = this->connecting;