X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fhandshaketimer.cpp;h=4aeb1da88e2eefd86321e9080ee373ad117e088f;hb=66d187fa55b4fdcb38ec987c269c4c1573a441b5;hp=97c9ed93e19ea6e2c1b00fc4100b8fc93d7ebaf6;hpb=594d923190c5af67533c6ee6a8fd9b2715fbc979;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index 97c9ed93e..4aeb1da88 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -1,3 +1,17 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" #include "configreader.h" #include "users.h" #include "channels.h" @@ -5,7 +19,6 @@ #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" -#include "inspircd.h" #include "wildcard.h" #include "xline.h" #include "transport.h" @@ -19,7 +32,7 @@ /* $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) : InspTimer(1, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : InspTimer(delay, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u) { thefd = sock->GetFd(); } @@ -28,18 +41,22 @@ void HandshakeTimer::Tick(time_t TIME) { if (Instance->SE->GetRef(thefd) == sock) { - if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) + if (!sock->GetHook()) { - InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); sock->SendCapabilities(); - if (sock->GetLinkState() == CONNECTING) - { - sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+lnk->SendPass+" 0 :"+this->Instance->Config->ServerDesc); - } } else { - Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils)); + if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) + { + InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send(); + sock->SendCapabilities(); + } + else + { + Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils, 1)); + } } } } +