summaryrefslogtreecommitdiff
path: root/src/network/socket_handler.hpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-02-22 23:35:14 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-02-22 23:35:14 +0100
commit730cc6e1bd52ed2f9e785b08bfbe91e0d42605e5 (patch)
tree681b3363379a03bac3cef0f103ad2becfcd76e0a /src/network/socket_handler.hpp
parent99aba5667d0d7ba6657f9c175a9342126bc4b0f2 (diff)
downloadbiboumi-730cc6e1bd52ed2f9e785b08bfbe91e0d42605e5.tar.gz
biboumi-730cc6e1bd52ed2f9e785b08bfbe91e0d42605e5.tar.bz2
biboumi-730cc6e1bd52ed2f9e785b08bfbe91e0d42605e5.tar.xz
biboumi-730cc6e1bd52ed2f9e785b08bfbe91e0d42605e5.zip
Save the addrinfo values for reuse on subsequent connect() call
Diffstat (limited to 'src/network/socket_handler.hpp')
-rw-r--r--src/network/socket_handler.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/socket_handler.hpp b/src/network/socket_handler.hpp
index cb09e4e..04e215a 100644
--- a/src/network/socket_handler.hpp
+++ b/src/network/socket_handler.hpp
@@ -1,6 +1,10 @@
#ifndef SOCKET_HANDLER_INCLUDED
# define SOCKET_HANDLER_INCLUDED
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
#include <string>
#include <utility>
@@ -105,6 +109,13 @@ protected:
* Port we are connected/connecting to
*/
std::string port;
+ /**
+ * Keep the details of the addrinfo the triggered a EINPROGRESS error when
+ * connect()ing to it, to reuse it directly when connect() is called
+ * again.
+ */
+ struct sockaddr ai_addr;
+ socklen_t ai_addrlen;
bool connected;
bool connecting;