- updated FTP code to use specific ports for MG and not random FTP ports

This commit is contained in:
Mark Vejvoda
2011-01-06 00:52:00 +00:00
parent b5dd9591da
commit a5a744fcad
12 changed files with 167 additions and 47 deletions

View File

@@ -36,17 +36,22 @@ ip_t FindExternalFTPServerIp(ip_t clientIp) {
return result;
}
FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,std::pair<string,string> tilesetsPath, int portNumber) : BaseThread() {
FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,std::pair<string,string> tilesetsPath, int portNumber, int maxPlayers) : BaseThread() {
this->mapsPath = mapsPath;
this->tilesetsPath = tilesetsPath;
this->portNumber = portNumber;
this->maxPlayers = maxPlayers;
ftpInit(&FindExternalFTPServerIp,&UPNP_Tools::AddUPNPPortForward,&UPNP_Tools::RemoveUPNPPortForward);
VERBOSE_MODE_ENABLED = SystemFlags::VERBOSE_MODE_ENABLED;
}
FTPServerThread::~FTPServerThread() {
// Remove any UPNP port forwarded ports
UPNP_Tools::upnp_rem_redirect(ServerSocket::getFTPServerPort());
for(int clientIndex = 1; clientIndex <= maxPlayers; ++clientIndex) {
UPNP_Tools::upnp_rem_redirect(ServerSocket::getFTPServerPort() + clientIndex);
}
}
void FTPServerThread::signalQuit() {