From 82e7e21e155c7b42767ab167baac874efde5c22d Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 28 Aug 2006 13:32:20 +0000 Subject: Connect timeouts now work again, using InspSocket git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5041 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspsocket.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'include/inspsocket.h') 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 outbuffer; /** @@ -91,13 +107,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. @@ -267,14 +276,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. -- cgit v1.2.3