diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-28 13:32:20 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-28 13:32:20 +0000 |
commit | 82e7e21e155c7b42767ab167baac874efde5c22d (patch) | |
tree | 58db3e877b905a8d2b39bc5595eb1cc325963251 /include | |
parent | 104cf9cbee8ae0c6994060b565fe410e8f140ed7 (diff) |
Connect timeouts now work again, using InspSocket
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5041 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/inspsocket.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/include/inspsocket.h b/include/inspsocket.h index 3791aa3e0..31f147ab8 100644 --- a/include/inspsocket.h +++ b/include/inspsocket.h @@ -24,6 +24,7 @@ #include "inspircd_config.h" #include "socket.h" #include "inspsocket.h" +#include "timer.h" /** * States which a socket may be in @@ -43,6 +44,17 @@ using irc::sockets::insp_inaddr; using irc::sockets::insp_ntoa; using irc::sockets::insp_aton; +class SocketTimeout : public InspTimer +{ + private: + InspSocket* sock; + InspIRCd* ServerInstance; + int sfd; + public: + SocketTimeout(int fd, InspIRCd* Instance, InspSocket* thesock, long secs_from_now, time_t now) : InspTimer(secs_from_now, now), sock(thesock), ServerInstance(Instance), sfd(fd) { }; + virtual void Tick(time_t now); +}; + /** * InspSocket is an extendable socket class which modules * can use for TCP socket support. It is fully integrated @@ -59,6 +71,10 @@ class InspSocket : public EventHandler public: InspIRCd* Instance; + SocketTimeout* Timeout; + + unsigned long timeout_val; + std::deque<std::string> outbuffer; /** @@ -92,13 +108,6 @@ class InspSocket : public EventHandler insp_inaddr addy; /** - * When this time is reached, - * the socket times out if it is - * in the CONNECTING state - */ - time_t timeout_end; - - /** * This value is true if the * socket has timed out. */ @@ -268,14 +277,6 @@ class InspSocket : public EventHandler std::string GetIP(); /** - * This function checks if the socket has - * timed out yet, given the current time - * in the parameter. - * @return true if timed out, false if not timed out - */ - bool Timeout(time_t current); - - /** * Writes a std::string to the socket. No carriage * returns or linefeeds are appended to the string. * @param data The data to send |