1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 04:23:12 +02:00

Rewrote some of the socket code to allow m_ssl to be a service.

This allows modules (xmlrpc) to create and accept SSL connections.
Also fixed unloading m_mysql at certain times and made the threading
engine always work correctly on Windows.
This commit is contained in:
Adam
2010-10-01 21:01:49 -04:00
parent 70056dd468
commit d44f7971b1
25 changed files with 756 additions and 383 deletions
+20 -20
View File
@@ -104,27 +104,23 @@ class UpdateTimer : public Timer
}
};
Socket *UplinkSock = NULL;
ConnectionSocket *UplinkSock = NULL;
class UplinkSocket : public ClientSocket
UplinkSocket::UplinkSocket(bool ipv6) : ConnectionSocket(ipv6)
{
public:
UplinkSocket(const Anope::string &nTargetHost, int nPort, const Anope::string &nBindHost = "", bool nIPv6 = false) : ClientSocket(nTargetHost, nPort, nBindHost, nIPv6)
{
UplinkSock = this;
}
UplinkSock = this;
}
~UplinkSocket()
{
UplinkSock = NULL;
}
UplinkSocket::~UplinkSocket()
{
UplinkSock = NULL;
}
bool Read(const Anope::string &buf)
{
process(buf);
return true;
}
};
bool UplinkSocket::Read(const Anope::string &buf)
{
process(buf);
return true;
}
/*************************************************************************/
@@ -354,13 +350,14 @@ static bool Connect()
if (MOD_RESULT != EVENT_CONTINUE)
{
if (MOD_RESULT == EVENT_STOP)
break;
continue;
return true;
}
try
{
new UplinkSocket(uplink_server->host, uplink_server->port, Config->LocalHost, uplink_server->ipv6);
new UplinkSocket(uplink_server->ipv6);
UplinkSock->Connect(uplink_server->host, uplink_server->port, Config->LocalHost);
}
catch (const SocketException &ex)
{
@@ -368,7 +365,7 @@ static bool Connect()
continue;
}
Log() << "Connected to Server " << servernum << " (" << uplink_server->host << ":" << uplink_server->port << ")";
Log() << "Connected to server " << servernum << " (" << uplink_server->host << ":" << uplink_server->port << ")";
return true;
}
@@ -469,6 +466,9 @@ int main(int ac, char **av, char **envp)
last_check = Anope::CurTime;
}
/* Free up any finished threads */
threadEngine.Process();
/* Process any modes that need to be (un)set */
ModeManager::ProcessModes();