The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

handshaketimer.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *            the file COPYING for details.
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 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
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