handshaketimer.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "inspircd.h"
00015 #include "commands/cmd_whois.h"
00016 #include "commands/cmd_stats.h"
00017 #include "socket.h"
00018 #include "xline.h"
00019 #include "transport.h"
00020
00021 #include "m_spanningtree/main.h"
00022 #include "m_spanningtree/utils.h"
00023 #include "m_spanningtree/treeserver.h"
00024 #include "m_spanningtree/link.h"
00025 #include "m_spanningtree/treesocket.h"
00026 #include "m_spanningtree/handshaketimer.h"
00027
00028
00029
00030 HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u)
00031 {
00032 thefd = sock->GetFd();
00033 }
00034
00035 void HandshakeTimer::Tick(time_t TIME)
00036 {
00037 if (Instance->SE->GetRef(thefd) == sock)
00038 {
00039 if (!sock->GetHook())
00040 {
00041 sock->SendCapabilities();
00042 }
00043 else
00044 {
00045 if (sock->GetHook() && BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
00046 {
00047 BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
00048 sock->SendCapabilities();
00049 }
00050 else
00051 {
00052 Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils, 1));
00053 }
00054 }
00055 }
00056 }
00057