From 05a82b810f09d5cf3a0388fc4eeb523d33662c9c Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 1 Dec 2015 16:09:21 +0100 Subject: Display a better error when connection fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error should not tell “while reading” when we are just connecting. --- louloulibs/network/tcp_socket_handler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3