X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fhandshaketimer.cpp;h=66adf33e671d6b4befbb3b522c5a5e85ac2a4b53;hb=715074dd10079a3ed846e8815290ba0d13cd4bd8;hp=150c9eecd1033c6d06e4518bee4b28f946caa901;hpb=9da5c6610fffc9677646ef1d55c0e41fca8778a9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index 150c9eecd..66adf33e6 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -1,3 +1,16 @@ +/* +------------------------------------+ + * | 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 "configreader.h" #include "users.h" #include "channels.h" @@ -19,31 +32,30 @@ /* $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(); } void HandshakeTimer::Tick(time_t TIME) { - Instance->Log(DEBUG,"Tick handshake timer."); if (Instance->SE->GetRef(thefd) == sock) { - Instance->Log(DEBUG,"Socket still here"); - if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send()) + if (!sock->GetHook()) { - Instance->Log(DEBUG,"request complete"); - 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->Log(DEBUG,"Request not yet complete"); - 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)); + } } } }