summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-01 21:01:49 -0400
committerAdam <Adam@anope.org>2010-10-01 21:01:49 -0400
commitd44f7971b129aa7ba80999f16f17b8c7499686e1 (patch)
treea86d08c3e641ed6b499b53b3bbb74e2a7f5b0dfb /src/main.cpp
parent70056dd4689eeab4f7a9b31a921e0d7e40d5ed0d (diff)
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.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a1417b197..2f37b64d8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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();