* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*/
#include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
#include "socket.h"
#include "xline.h"
-#include "transport.h"
-#include "m_hash.h"
+#include "../transport.h"
+#include "../m_hash.h"
#include "socketengine.h"
-#include "m_spanningtree/main.h"
-#include "m_spanningtree/utils.h"
-#include "m_spanningtree/treeserver.h"
-#include "m_spanningtree/link.h"
-#include "m_spanningtree/treesocket.h"
-#include "m_spanningtree/resolvers.h"
-#include "m_spanningtree/handshaketimer.h"
+#include "main.h"
+#include "utils.h"
+#include "treeserver.h"
+#include "link.h"
+#include "treesocket.h"
+#include "resolvers.h"
+#include "handshaketimer.h"
/* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_hash.h m_spanningtree/handshaketimer.h */
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod)
: BufferedSocket(SI, shost, iport, maxtime, bindto), Utils(Util), Hook(HookMod)
{
+ age = SI->Time();
myhost = ServerName;
- theirchallenge.clear();
- ourchallenge.clear();
- this->LinkState = CONNECTING;
+ capab_phase = 0;
+ proto_version = 0;
+ LinkState = CONNECTING;
Utils->timeoutlist[this] = std::pair<std::string, int>(ServerName, maxtime);
if (Hook)
BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send();
+ hstimer = NULL;
}
/** When a listening socket gives us a new file descriptor,
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, char* ip, Module* HookMod)
: BufferedSocket(SI, newfd, ip), Utils(Util), Hook(HookMod)
{
- this->LinkState = WAIT_AUTH_1;
- theirchallenge.clear();
- ourchallenge.clear();
- sentcapab = false;
+ age = SI->Time();
+ LinkState = WAIT_AUTH_1;
+ capab_phase = 0;
+ proto_version = 0;
/* If we have a transport module hooked to the parent, hook the same module to this
* socket, and set a timer waiting for handshake before we send CAPAB etc.
*/
if (Hook)
BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send();
- ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1));
+ hstimer = new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1);
+ ServerInstance->Timers->AddTimer(hstimer);
/* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */
Utils->timeoutlist[this] = std::pair<std::string, int>("<unknown>", 30);
return this->Hook;
}
+void TreeSocket::CleanNegotiationInfo()
+{
+ ModuleList.clear();
+ OptModuleList.clear();
+ CapKeys.clear();
+ ourchallenge.clear();
+ theirchallenge.clear();
+ OutboundPass.clear();
+}
+
TreeSocket::~TreeSocket()
{
if (Hook)
BufferedSocketUnhookRequest(this, (Module*)Utils->Creator, Hook).Send();
+ if (hstimer)
+ ServerInstance->Timers->DelTimer(hstimer);
Utils->timeoutlist.erase(this);
}
x->Hook.c_str());
}
this->OutboundPass = x->SendPass;
- sentcapab = false;
/* found who we're supposed to be connecting to, send the neccessary gubbins. */
if (this->GetHook())
- ServerInstance->Timers->AddTimer(new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1));
+ {
+ hstimer = new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1);
+ ServerInstance->Timers->AddTimer(hstimer);
+ }
else
- this->SendCapabilities();
+ this->SendCapabilities(1);
return true;
}
Event rmode((char*)Current->GetName().c_str(), (Module*)Utils->Creator, "lost_server");
rmode.Send(ServerInstance);
- std::deque<std::string> params;
+ parameterlist params;
params.push_back(Current->GetName());
params.push_back(":"+reason);
Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName());
if (data && *data)
{
this->in_buffer.append(data);
+ Utils->Creator->loopCall = true;
/* While there is at least one new line in the buffer,
* do something useful (we hope!) with it.
*/
return false;
}
}
+ Utils->Creator->loopCall = false;
return true;
}
/* EAGAIN returns an empty but non-NULL string, so this