]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/handshaketimer.cpp
Remove debug, add a few comments
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / handshaketimer.cpp
1 #include "configreader.h"
2 #include "users.h"
3 #include "channels.h"
4 #include "modules.h"
5 #include "commands/cmd_whois.h"
6 #include "commands/cmd_stats.h"
7 #include "socket.h"
8 #include "inspircd.h"
9 #include "wildcard.h"
10 #include "xline.h"
11 #include "transport.h"
12
13 #include "m_spanningtree/main.h"
14 #include "m_spanningtree/utils.h"
15 #include "m_spanningtree/treeserver.h"
16 #include "m_spanningtree/link.h"
17 #include "m_spanningtree/treesocket.h"
18 #include "m_spanningtree/handshaketimer.h"
19
20 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
21
22 HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u) : InspTimer(1, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u)
23 {
24         thefd = sock->GetFd();
25 }
26
27 void HandshakeTimer::Tick(time_t TIME)
28 {
29         if (Instance->SE->GetRef(thefd) == sock)
30         {
31                 if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
32                 {
33                         InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
34                         sock->SendCapabilities();
35                         if (sock->GetLinkState() == CONNECTING)
36                         {
37                                 sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+lnk->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
38                         }
39                 }
40                 else
41                 {
42                         Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils));
43                 }
44         }
45 }
46