Added amb1978 - Core.cfg now has parameters to set the gamedata auto-updater server and port.
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402487
This commit is contained in:
		
							parent
							
								
									fe4e39a2dd
								
							
						
					
					
						commit
						9ef7dca666
					
				| @ -102,4 +102,14 @@ | |||||||
| 	 * The default value is "no". A value of "yes" will let the server automatically restart. | 	 * The default value is "no". A value of "yes" will let the server automatically restart. | ||||||
| 	 */ | 	 */ | ||||||
| 	"ForceRestartAfterUpdate"		"no" | 	"ForceRestartAfterUpdate"		"no" | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Sets the server to connect to for auotmatic gamedata updates. | ||||||
|  | 	 */ | ||||||
|  | 	"AutoUpdateServer"		"hayate.alliedmods.net" | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Sets the port to connect to on the AutoUpdateServer server | ||||||
|  | 	 */ | ||||||
|  | 	"AutoUpdatePort"			"6500" | ||||||
| } | } | ||||||
|  | |||||||
| @ -60,6 +60,7 @@ | |||||||
| #include "time.h" | #include "time.h" | ||||||
| #include "TimerSys.h" | #include "TimerSys.h" | ||||||
| #include "compat_wrappers.h" | #include "compat_wrappers.h" | ||||||
|  | #include "sm_stringutil.h" | ||||||
| 
 | 
 | ||||||
| #define QUERY_MAX_LENGTH 1024 | #define QUERY_MAX_LENGTH 1024 | ||||||
| 
 | 
 | ||||||
| @ -71,6 +72,9 @@ FILE *logfile = NULL; | |||||||
| bool g_disableGameDataUpdate = false; | bool g_disableGameDataUpdate = false; | ||||||
| bool g_restartAfterUpdate = false; | bool g_restartAfterUpdate = false; | ||||||
| 
 | 
 | ||||||
|  | int g_serverPort = 6500; | ||||||
|  | char g_serverAddress[100] = "hayate.alliedmods.net"; | ||||||
|  | 
 | ||||||
| void FetcherThread::RunThread( IThreadHandle *pHandle ) | void FetcherThread::RunThread( IThreadHandle *pHandle ) | ||||||
| { | { | ||||||
| 	char lock_path[PLATFORM_MAX_PATH]; | 	char lock_path[PLATFORM_MAX_PATH]; | ||||||
| @ -269,13 +273,13 @@ int FetcherThread::ConnectSocket() | |||||||
| 	struct sockaddr_in local_addr; | 	struct sockaddr_in local_addr; | ||||||
| 
 | 
 | ||||||
| 	local_addr.sin_family = AF_INET; | 	local_addr.sin_family = AF_INET; | ||||||
| 	local_addr.sin_port = htons((u_short)6500); | 	local_addr.sin_port = htons((u_short)g_serverPort); | ||||||
| 
 | 
 | ||||||
| 	he = gethostbyname("hayate.alliedmods.net"); | 	he = gethostbyname(g_serverAddress); | ||||||
| 
 | 
 | ||||||
| 	if (!he) | 	if (!he) | ||||||
| 	{ | 	{ | ||||||
| 		if ((local_addr.sin_addr.s_addr = inet_addr("hayate.alliedmods.net")) == INADDR_NONE) | 		if ((local_addr.sin_addr.s_addr = inet_addr(g_serverAddress)) == INADDR_NONE) | ||||||
| 		{ | 		{ | ||||||
| 			g_Logger.LogToOpenFile(logfile, "Couldnt locate address"); | 			g_Logger.LogToOpenFile(logfile, "Couldnt locate address"); | ||||||
| 			closesocket(socketDescriptor); | 			closesocket(socketDescriptor); | ||||||
| @ -645,6 +649,27 @@ public: | |||||||
| 			return ConfigResult_Reject; | 			return ConfigResult_Reject; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		if (strcmp(key, "AutoUpdateServer") == 0) | ||||||
|  | 		{ | ||||||
|  | 			UTIL_Format(g_serverAddress, sizeof(g_serverAddress), "%s", value); | ||||||
|  | 
 | ||||||
|  | 			return ConfigResult_Accept; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		if (strcmp(key, "AutoUpdatePort") == 0) | ||||||
|  | 		{ | ||||||
|  | 			int port = atoi(value); | ||||||
|  | 
 | ||||||
|  | 			if (!port) | ||||||
|  | 			{ | ||||||
|  | 				return ConfigResult_Reject; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			g_serverPort = port; | ||||||
|  | 
 | ||||||
|  | 			return ConfigResult_Accept; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		return ConfigResult_Ignore; | 		return ConfigResult_Ignore; | ||||||
| 	} | 	} | ||||||
| } g_InitFetch; | } g_InitFetch; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user