summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-04-09 23:51:06 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-21 18:00:09 +0200
commit1638ee61936bc91758be39c3463c6e46d0d655e7 (patch)
tree3ad0357587a58bc3845cb3a328bf3e95fadf2923 /src/inspsocket.cpp
parente9e75e50bc25e67af22dd88b39b12217a553d5cb (diff)
Timer changes and TimerManager enhancements
Timer::Tick() now has a bool return value: if false is returned the timer is deleted using operator delete, otherwise, if it's a repeating timer then it's rescheduled (readded) Timers are removed from the TimerManager automatically at destruction Timers are now stored in a multimap instead of a sorted vector
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index fdd002ad6..5f2da2341 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -431,12 +431,12 @@ void StreamSocket::WriteData(const std::string &data)
ServerInstance->SE->ChangeEventMask(this, FD_ADD_TRIAL_WRITE);
}
-void SocketTimeout::Tick(time_t)
+bool SocketTimeout::Tick(time_t)
{
ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"SocketTimeout::Tick");
if (ServerInstance->SE->GetRef(this->sfd) != this->sock)
- return;
+ return false;
if (this->sock->state == I_CONNECTING)
{
@@ -452,6 +452,7 @@ void SocketTimeout::Tick(time_t)
}
this->sock->Timeout = NULL;
+ return false;
}
void BufferedSocket::OnConnected() { }
@@ -476,8 +477,8 @@ BufferedSocket::~BufferedSocket()
this->Close();
if (Timeout)
{
- ServerInstance->Timers->DelTimer(Timeout);
- Timeout = NULL;
+ // The timer is removed from the TimerManager in Timer::~Timer()
+ delete Timeout;
}
}