Ejemplo n.º 1
0
/** Because most of the I/O gubbins are encapsulated within
 * BufferedSocket, we just call the superclass constructor for
 * most of the action, and append a few of our own values
 * to it.
 */
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, Link* link, Autoconnect* myac, const std::string& ipaddr)
	: Utils(Util)
{
	age = ServerInstance->Time();
	linkID = assign(link->Name);
	capab = new CapabData;
	capab->link = link;
	capab->ac = myac;
	capab->capab_phase = 0;
	MyRoot = NULL;
	proto_version = 0;
	ConnectionFailureShown = false;
	LinkState = CONNECTING;
	if (!link->Hook.empty())
	{
		ServiceProvider* prov = ServerInstance->Modules->FindService(SERVICE_IOHOOK, link->Hook);
		if (!prov)
		{
			SetError("Could not find hook '" + link->Hook + "' for connection to " + linkID);
			return;
		}
		AddIOHook(prov->creator);
	}
	DoConnect(ipaddr, link->Port, link->Timeout, link->Bind);
	Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, link->Timeout);
	SendCapabilities(1);
}
Ejemplo n.º 2
0
/** Because most of the I/O gubbins are encapsulated within
 * BufferedSocket, we just call the superclass constructor for
 * most of the action, and append a few of our own values
 * to it.
 */
TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr)
	: linkID(assign(link->Name)), LinkState(CONNECTING), MyRoot(NULL), proto_version(0), ConnectionFailureShown(false)
	, age(ServerInstance->Time())
{
	capab = new CapabData;
	capab->link = link;
	capab->ac = myac;
	capab->capab_phase = 0;
	if (!link->Hook.empty())
	{
		ServiceProvider* prov = ServerInstance->Modules->FindService(SERVICE_IOHOOK, link->Hook);
		if (!prov)
		{
			SetError("Could not find hook '" + link->Hook + "' for connection to " + linkID);
			return;
		}
		AddIOHook(static_cast<IOHook*>(prov));
	}
	DoConnect(ipaddr, link->Port, link->Timeout, link->Bind);
	Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, link->Timeout);
	SendCapabilities(1);
}