diff options
author | louiz’ <louiz@louiz.org> | 2016-11-11 03:03:42 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-11-11 03:03:42 +0100 |
commit | ed7e66471f7018f2e7e1c6a469e5cd758b913255 (patch) | |
tree | 870e95e6b62dff42d4ff770f16dc24125347b703 | |
parent | 0c8adc85f7373a85de8b3edc6cac87d5f7389bb3 (diff) | |
download | biboumi-ed7e66471f7018f2e7e1c6a469e5cd758b913255.tar.gz biboumi-ed7e66471f7018f2e7e1c6a469e5cd758b913255.tar.bz2 biboumi-ed7e66471f7018f2e7e1c6a469e5cd758b913255.tar.xz biboumi-ed7e66471f7018f2e7e1c6a469e5cd758b913255.zip |
Add missing cstring include for strerror
-rw-r--r-- | louloulibs/network/tcp_client_socket_handler.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/louloulibs/network/tcp_client_socket_handler.cpp b/louloulibs/network/tcp_client_socket_handler.cpp index 2de9696..f22d756 100644 --- a/louloulibs/network/tcp_client_socket_handler.cpp +++ b/louloulibs/network/tcp_client_socket_handler.cpp @@ -5,6 +5,7 @@ #include <logger/logger.hpp> +#include <cstring> #include <unistd.h> #include <fcntl.h> @@ -27,7 +28,7 @@ void TCPClientSocketHandler::init_socket(const struct addrinfo* rp) if (this->socket != -1) ::close(this->socket); if ((this->socket = ::socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) == -1) - throw std::runtime_error("Could not create socket: "s + strerror(errno)); + throw std::runtime_error("Could not create socket: "s + std::strerror(errno)); // Bind the socket to a specific address, if specified if (!this->bind_addr.empty()) { @@ -66,7 +67,7 @@ void TCPClientSocketHandler::init_socket(const struct addrinfo* rp) const int existing_flags = ::fcntl(this->socket, F_GETFL, 0); if ((existing_flags == -1) || (::fcntl(this->socket, F_SETFL, existing_flags | O_NONBLOCK) == -1)) - throw std::runtime_error("Could not initialize socket: "s + strerror(errno)); + throw std::runtime_error("Could not initialize socket: "s + std::strerror(errno)); } void TCPClientSocketHandler::connect(const std::string& address, const std::string& port, const bool tls) @@ -176,11 +177,11 @@ void TCPClientSocketHandler::connect(const std::string& address, const std::stri "connection_timeout"s + std::to_string(this->socket))); return ; } - log_info("Connection failed:", strerror(errno)); + log_info("Connection failed:", std::strerror(errno)); } log_error("All connection attempts failed."); this->close(); - this->on_connection_failed(strerror(errno)); + this->on_connection_failed(std::strerror(errno)); return ; } |