mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
add connections per ip limit to the connection server (public port only)
This commit is contained in:
@@ -88,6 +88,7 @@ void ConfigConnectionServer::install(void)
|
||||
KEY_INT (lagReportThreshold, 10000);
|
||||
KEY_INT (defaultGameFeatures, 0xFFFFFFFF);
|
||||
KEY_INT (defaultSubscriptionFeatures, 0xFFFFFFFF);
|
||||
KEY_INT (maxConnectionsPerIP, 6);
|
||||
|
||||
KEY_BOOL (validateStationKey, false);
|
||||
KEY_STRING (sessionServers, "");
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
int clientMaxDataHoldTime;
|
||||
int clientHashTableSize;
|
||||
int lagReportThreshold;
|
||||
int maxConnectionsPerIP;
|
||||
|
||||
bool validateStationKey;
|
||||
const char * sessionServers;
|
||||
@@ -133,6 +134,7 @@ public:
|
||||
static bool getValidateClientVersion();
|
||||
|
||||
static int getConnectionServerNumber();
|
||||
static int getMaxConnectionsPerIP();
|
||||
static int getFakeBuddyPoints();
|
||||
|
||||
static const char * getPublicBindAddress();
|
||||
@@ -465,4 +467,9 @@ inline int ConfigConnectionServer::getConnectionServerNumber()
|
||||
return data->connectionServerNumber;
|
||||
}
|
||||
|
||||
inline const int ConfigConnectionServer::getMaxConnectionsPerIP()
|
||||
{
|
||||
return data->maxConnectionsPerIP;
|
||||
}
|
||||
|
||||
#endif // _ConfigConnectionServer_H
|
||||
|
||||
@@ -110,6 +110,7 @@ ConnectionServer::ConnectionServer() :
|
||||
s_clientServiceSetup->maxDataHoldTime = ConfigConnectionServer::getClientMaxDataHoldTime();
|
||||
s_clientServiceSetup->hashTableSize = ConfigConnectionServer::getClientHashTableSize();
|
||||
s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPublic();
|
||||
s_clientServiceSetup->maxConnectionsPerIP = ConfigConnectionServer::getMaxConnectionsPerIP();
|
||||
s_clientServiceSetup->compress = ConfigConnectionServer::getCompressClientNetworkTraffic();
|
||||
s_clientServiceSetup->useTcp = false;
|
||||
|
||||
@@ -556,15 +557,17 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Opened connection with central\n"));
|
||||
centralConnection = const_cast<CentralConnection *>(static_cast<const CentralConnection *>(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small)
|
||||
if (s_clientServiceSetup == 0)
|
||||
s_clientServiceSetup = new NetworkSetupData;
|
||||
|
||||
s_clientServiceSetup->useTcp = false;
|
||||
if (ConfigConnectionServer::getStartPublicServer())
|
||||
{
|
||||
s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPublic();
|
||||
s_clientServiceSetup->maxConnectionsPerIP = ConfigConnectionServer::getMaxConnectionsPerIP();
|
||||
clientServicePublic = new Service(ConnectionAllocator<ClientConnection>(), *s_clientServiceSetup);
|
||||
}
|
||||
|
||||
s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPrivate();
|
||||
s_clientServiceSetup->maxConnectionsPerIP = 0;
|
||||
clientServicePrivate = new Service(ConnectionAllocator<ClientConnection>(), *s_clientServiceSetup);
|
||||
s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPublic();
|
||||
|
||||
connectToMessage("ClientConnectionOpened");
|
||||
connectToMessage("ClientConnectionClosed");
|
||||
@@ -608,8 +611,9 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: wtf is this? @Darth, fix it!
|
||||
//If they aren't connected to the game yet, they're probably on the pending list.
|
||||
// removePendingCharacter(cconn->getSUID());
|
||||
//removePendingCharacter(cconn->getSUID());
|
||||
}
|
||||
removeFromConnectedMap(cconn->getSUID());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user