]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/handshaketimer.cpp
Remove InspIRCd* parameters and fields
[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 "socket.h"
16 #include "xline.h"
17 #include "../transport.h"
18
19 #include "main.h"
20 #include "utils.h"
21 #include "treeserver.h"
22 #include "link.h"
23 #include "treesocket.h"
24 #include "handshaketimer.h"
25
26 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
27
28 HandshakeTimer::HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay)
29         : Timer(delay, ServerInstance->Time(), true), sock(s), lnk(l), Utils(u)
30 {
31         thefd = sock->GetFd();
32 }
33
34 HandshakeTimer::~HandshakeTimer()
35 {
36         sock->hstimer = NULL;
37 }
38
39 void HandshakeTimer::Tick(time_t TIME)
40 {
41         if (!sock->GetIOHook())
42         {
43                 CancelRepeat();
44                 sock->SendCapabilities(1);
45         }
46         else if (BufferedSocketHSCompleteRequest(sock, Utils->Creator, sock->GetIOHook()).Send())
47         {
48                 CancelRepeat();
49                 BufferedSocketAttachCertRequest(sock, Utils->Creator, sock->GetIOHook()).Send();
50                 sock->SendCapabilities(1);
51         }
52         // otherwise, try again later
53 }
54