X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fhandshaketimer.cpp;h=1b3b1dd2227ba16176fa6de18d78f167fcdd0480;hb=8cebe2878f3878afce6f643d93668155cb26801d;hp=d2e0530470e242f40c31821387801869bec8f740;hpb=b6dbd6caab62bc2c0d11ce5a45d511611eb9c2ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index d2e053047..1b3b1dd22 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -16,42 +16,40 @@ #include "commands/cmd_stats.h" #include "socket.h" #include "xline.h" -#include "transport.h" +#include "../transport.h" -#include "m_spanningtree/main.h" -#include "m_spanningtree/utils.h" -#include "m_spanningtree/treeserver.h" -#include "m_spanningtree/link.h" -#include "m_spanningtree/treesocket.h" -#include "m_spanningtree/handshaketimer.h" +#include "main.h" +#include "utils.h" +#include "treeserver.h" +#include "link.h" +#include "treesocket.h" +#include "handshaketimer.h" /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time()), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time(), true), Instance(Inst), sock(s), lnk(l), Utils(u) { 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()) - { - sock->SendCapabilities(); - } - else - { - if (sock->GetHook() && BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) - { - BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); - sock->SendCapabilities(); - } - else - { - Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils, 1)); - } - } + CancelRepeat(); + BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); + sock->SendCapabilities(); } + // otherwise, try again later }