summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/inspsocket.h31
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