summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/handshaketimer.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-07 14:51:10 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-07 14:51:10 +0000
commitb2159a9e4f40fcbe755f8c0d2e6a7cbfcfd09f4f (patch)
tree9c80d4742519339edfbc66d439c6b05390f0c762 /src/modules/m_spanningtree/handshaketimer.cpp
parent999febbac6ee73cb0c307fef1469818d47ff685c (diff)
Remove handshake timer on server sockets that die before completing handshake
This fixes some very subtle and hard-to-trace bugs that are triggered when a file descriptor and memory address of an EventHandler* are reused after being deallocated. Impossible to trigger in valgrind; has been seen in live networks. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11369 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/handshaketimer.cpp')
-rw-r--r--src/modules/m_spanningtree/handshaketimer.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp
index ae41bad0a..14b27472c 100644
--- a/src/modules/m_spanningtree/handshaketimer.cpp
+++ b/src/modules/m_spanningtree/handshaketimer.cpp
@@ -32,28 +32,24 @@ HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningT
thefd = sock->GetFd();
}
+HandshakeTimer::~HandshakeTimer()
+{
+ sock->hstimer = NULL;
+}
+
void HandshakeTimer::Tick(time_t TIME)
{
- if (Instance->SE->GetRef(thefd) == sock)
+ if (!sock->GetHook())
+ {
+ CancelRepeat();
+ sock->SendCapabilities();
+ }
+ else if (BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
{
- if (!sock->GetHook())
- {
- CancelRepeat();
- sock->SendCapabilities();
- }
- else
- {
- if (sock->GetHook() && BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
- {
- CancelRepeat();
- BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
- sock->SendCapabilities();
- }
- else
- {
- // Try again later...
- }
- }
+ CancelRepeat();
+ BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
+ sock->SendCapabilities();
}
+ // otherwise, try again later
}