summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 15:45:25 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 15:45:25 +0000
commit0fbc81cffcf28adb80b731f3604d7ea02c32f86b (patch)
tree8feb07ea861a4c8fb32b7eab1a449ba1d5c1635d /src/socket.cpp
parentebe735d5f37b504f0b4c95ca1f827d18b03dae08 (diff)
Fixed timeout code
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2344 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 4e8c88663..625c0ff70 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -194,9 +194,9 @@ int InspSocket::Write(std::string data)
return written;
}
-bool InspSocket::Poll()
+bool InspSocket::Timeout(time_t current)
{
- if ((time(NULL) > timeout_end) && (this->state == I_CONNECTING))
+ if ((this->state == I_CONNECTING) && (current > timeout_end))
{
// for non-listening sockets, the timeout can occur
// which causes termination of the connection after
@@ -204,11 +204,15 @@ bool InspSocket::Poll()
// connection.
this->OnTimeout();
this->OnError(I_ERR_TIMEOUT);
- timeout = true;
+ timeout = true;
this->state = I_ERROR;
- return false;
+ return true;
}
+ return false;
+}
+bool InspSocket::Poll()
+{
int incoming = -1;
switch (this->state)