mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 20:03:58 +02:00
- more bugfixes related to ftp and firewall handling
This commit is contained in:
@@ -425,7 +425,7 @@ void ConnectionSlot::update(bool checkForNewClients) {
|
|||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
gotIntro = true;
|
gotIntro = true;
|
||||||
|
|
||||||
this->serverInterface->addClientToServerIPAddress(this->getSocket()->getConnectedIPAddress(this->getSocket()->getIp()),this->connectedRemoteIPAddress);
|
this->serverInterface->addClientToServerIPAddress(this->getSocket()->getConnectedIPAddress(this->getSocket()->getIpAddress()),this->connectedRemoteIPAddress);
|
||||||
|
|
||||||
if(getAllowGameDataSynchCheck() == true && serverInterface->getGameSettings() != NULL) {
|
if(getAllowGameDataSynchCheck() == true && serverInterface->getGameSettings() != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] sending NetworkMessageSynchNetworkGameData\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] sending NetworkMessageSynchNetworkGameData\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@@ -682,10 +682,19 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len)
|
|||||||
}
|
}
|
||||||
ftpGetSession(sessionId)->passiveDataSocket = s;
|
ftpGetSession(sessionId)->passiveDataSocket = s;
|
||||||
|
|
||||||
if(ftpFindExternalFTPServerIp(ftpGetSession(sessionId)->remoteIp) > 0)
|
#if DBG_LOG
|
||||||
|
printf("In ftpCmdPasv sessionId = %d, client IP = %u, remote IP = %u, port = %d, ftpAddUPNPPortForward = %p, ftpRemoveUPNPPortForward = %p\n",
|
||||||
|
sessionId, ftpGetSession(sessionId)->remoteIp, ftpFindExternalFTPServerIp(ftpGetSession(sessionId)->remoteIp), port,ftpAddUPNPPortForward,ftpRemoveUPNPPortForward);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(ftpFindExternalFTPServerIp(ftpGetSession(sessionId)->remoteIp) != 0)
|
||||||
{
|
{
|
||||||
ftpGetSession(sessionId)->remoteFTPServerPassivePort = port;
|
ftpGetSession(sessionId)->remoteFTPServerPassivePort = port;
|
||||||
if(ftpAddUPNPPortForward) {
|
if(ftpAddUPNPPortForward) {
|
||||||
|
#if DBG_LOG
|
||||||
|
printf("In ftpCmdPasv sessionId = %d, adding UPNP port forward\n", sessionId);
|
||||||
|
#endif
|
||||||
|
|
||||||
ftpAddUPNPPortForward(port, port);
|
ftpAddUPNPPortForward(port, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,6 +708,11 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len)
|
|||||||
remoteFTPServerIp & 0xFF,
|
remoteFTPServerIp & 0xFF,
|
||||||
(port >> 8) & 0xFF,
|
(port >> 8) & 0xFF,
|
||||||
port & 0xFF);
|
port & 0xFF);
|
||||||
|
|
||||||
|
#if DBG_LOG
|
||||||
|
printf("In ftpCmdPasv sessionId = %d, str [%s]\n", sessionId, str);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -119,10 +119,19 @@ int ftpAuthSession(int id)
|
|||||||
*/
|
*/
|
||||||
int ftpCloseSession(int id)
|
int ftpCloseSession(int id)
|
||||||
{
|
{
|
||||||
if(ftpFindExternalFTPServerIp != NULL && ftpFindExternalFTPServerIp(sessions[id].remoteIp) > 0)
|
#if DBG_LOG
|
||||||
|
printf("In ftpCloseSession sessionId = %d, remote IP = %u, port = %d\n",
|
||||||
|
id, sessions[id].remoteIp, sessions[id].remoteFTPServerPassivePort);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(ftpFindExternalFTPServerIp != NULL && ftpFindExternalFTPServerIp(sessions[id].remoteIp) != 0)
|
||||||
{
|
{
|
||||||
if(ftpRemoveUPNPPortForward)
|
if(ftpRemoveUPNPPortForward)
|
||||||
{
|
{
|
||||||
|
#if DBG_LOG
|
||||||
|
printf("In ftpCmdPasv sessionId = %d, removing UPNP port forward [%d]\n", id,sessions[id].remoteFTPServerPassivePort);
|
||||||
|
#endif
|
||||||
|
|
||||||
ftpRemoveUPNPPortForward(sessions[id].remoteFTPServerPassivePort, sessions[id].remoteFTPServerPassivePort);
|
ftpRemoveUPNPPortForward(sessions[id].remoteFTPServerPassivePort, sessions[id].remoteFTPServerPassivePort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,11 @@ namespace Shared { namespace PlatformCommon {
|
|||||||
static std::map<uint32,uint32> clientToFTPServerList;
|
static std::map<uint32,uint32> clientToFTPServerList;
|
||||||
|
|
||||||
uint32 FindExternalFTPServerIp(uint32 clientIp) {
|
uint32 FindExternalFTPServerIp(uint32 clientIp) {
|
||||||
return clientToFTPServerList[clientIp];
|
uint32 result = clientToFTPServerList[clientIp];
|
||||||
|
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,int portNumber) : BaseThread() {
|
FTPServerThread::FTPServerThread(std::pair<string,string> mapsPath,int portNumber) : BaseThread() {
|
||||||
@@ -61,6 +65,8 @@ bool FTPServerThread::shutdownAndWait() {
|
|||||||
void FTPServerThread::addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp) {
|
void FTPServerThread::addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp) {
|
||||||
//ftpSetSessionRemoteServerIp(clientIp, ServerIp);
|
//ftpSetSessionRemoteServerIp(clientIp, ServerIp);
|
||||||
clientToFTPServerList[clientIp] = ServerIp;
|
clientToFTPServerList[clientIp] = ServerIp;
|
||||||
|
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, ServerIp = %u\n",clientIp,ServerIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FTPServerThread::execute() {
|
void FTPServerThread::execute() {
|
||||||
|
@@ -1669,8 +1669,12 @@ ServerSocket::~ServerSocket() {
|
|||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
stopBroadCastThread();
|
stopBroadCastThread();
|
||||||
|
if (ServerSocket::enabledUPNP) {
|
||||||
|
ServerSocket::enabledUPNP = false;
|
||||||
|
|
||||||
NETremRedirects(ServerSocket::externalPort);
|
NETremRedirects(ServerSocket::externalPort);
|
||||||
NETremRedirects(ServerSocket::ftpServerPort);
|
NETremRedirects(ServerSocket::ftpServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
@@ -2054,10 +2058,10 @@ void ServerSocket::NETaddRedirects(int ports[4]) {
|
|||||||
|
|
||||||
void ServerSocket::NETremRedirects(int ext_port) {
|
void ServerSocket::NETremRedirects(int ext_port) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork, "%s\n", __FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork, "%s\n", __FUNCTION__);
|
||||||
if (ServerSocket::enabledUPNP) {
|
//if (ServerSocket::enabledUPNP) {
|
||||||
ServerSocket::enabledUPNP = false;
|
//ServerSocket::enabledUPNP = false;
|
||||||
upnp_rem_redirect(ext_port);
|
upnp_rem_redirect(ext_port);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerSocket::NETdiscoverUPnPDevices() {
|
void ServerSocket::NETdiscoverUPnPDevices() {
|
||||||
|
Reference in New Issue
Block a user