]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/handshaketimer.cpp
Update all wiki links to point to the new wiki. This was done automatically with...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / handshaketimer.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
17 #include "socket.h"
18 #include "xline.h"
19 #include "transport.h"
20
21 #include "m_spanningtree/main.h"
22 #include "m_spanningtree/utils.h"
23 #include "m_spanningtree/treeserver.h"
24 #include "m_spanningtree/link.h"
25 #include "m_spanningtree/treesocket.h"
26 #include "m_spanningtree/handshaketimer.h"
27
28 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
29
30 HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time()), Instance(Inst), sock(s), lnk(l), Utils(u)
31 {
32         thefd = sock->GetFd();
33 }
34
35 void HandshakeTimer::Tick(time_t TIME)
36 {
37         if (Instance->SE->GetRef(thefd) == sock)
38         {
39                 if (!sock->GetHook())
40                 {
41                         sock->SendCapabilities();
42                 }
43                 else
44                 {
45                         if (sock->GetHook() && BufferedSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
46                         {
47                                 BufferedSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
48                                 sock->SendCapabilities();
49                         }
50                         else
51                         {
52                                 Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils, 1));
53                         }
54                 }
55         }
56 }
57