diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-23 18:12:56 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-23 18:12:56 +0000 |
commit | 22e136d88817b64ec904a7e7232a2cf9e80e74bd (patch) | |
tree | ea369bba78930ff55325412760d14102d326f85b /src/core/netconnection.h | |
parent | 8485d43feca5597c4b412c6912aadcd9586e3cde (diff) |
improved network connection handling, keep alive and time out
Diffstat (limited to 'src/core/netconnection.h')
-rw-r--r-- | src/core/netconnection.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/netconnection.h b/src/core/netconnection.h index dca85c7..08536de 100644 --- a/src/core/netconnection.h +++ b/src/core/netconnection.h @@ -67,6 +67,12 @@ public: inline bool connected() const { return ((connection_fd != -1) && !connection_error); } + enum State {Connecting=0, Connected=1}; + + inline State state() const { return connection_state; } + + State connection_state; + protected: /// receive incoming data and store messages void receive(); @@ -86,14 +92,14 @@ private: std::string sendq; fd_set clientset; + float connection_timeout; + float connection_keepalive; int connection_fd; bool connection_error; std::string connection_host; int connection_port; struct sockaddr_in server_addr; char recvbuf[BLOCKSIZE]; - - float timeout; }; } |