Save the addrinfo values for reuse on subsequent connect() call

This commit is contained in:
Florent Le Coz
2014-02-22 23:35:14 +01:00
parent 99aba5667d
commit 730cc6e1bd
2 changed files with 58 additions and 21 deletions
+11
View File
@@ -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;