X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_spanningtree%2Fhandshaketimer.cpp;h=b264a4c2fb242333ddc424f1404c23e54d39f4ec;hb=c440038736f749a56dbac1badee5b2f099286117;hp=c1e36df38c05b117ad4ab558163a5033137b8b63;hpb=e4acbc95b8b6cd5b28d38a2242c02e8ff4991e4a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index c1e36df38..b264a4c2f 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -12,47 +12,43 @@ */ #include "inspircd.h" -#include "commands/cmd_whois.h" -#include "commands/cmd_stats.h" #include "socket.h" -#include "wildcard.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, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) + : Timer(delay, ServerInstance->Time(), true), 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->GetIOHook()) + { + CancelRepeat(); + sock->SendCapabilities(1); + } + else if (BufferedSocketHSCompleteRequest(sock, Utils->Creator, sock->GetIOHook()).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, Utils->Creator, sock->GetIOHook()).Send(); + sock->SendCapabilities(1); } + // otherwise, try again later }