2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

do not attempt to get the server status if no status URL is specified

This commit is contained in:
diafero
2011-08-02 13:04:12 +02:00
parent 2f5b3200d7
commit 5e3223b542
3 changed files with 11 additions and 30 deletions

View File

@ -1193,7 +1193,7 @@ void StatusCallback(void *param)
curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback); curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback);
curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, param); curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, param);
if (curl_easy_perform(hCurl) != 0) if (statusUrl[0] && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) curlError); PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) curlError);
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i) for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i)

View File

@ -605,39 +605,19 @@ static size_t CurlCallback(void *buffer, size_t size, size_t nmemb, void *)
//============================================================================ //============================================================================
static void StatusCallback(void *) static void StatusCallback(void *)
{ {
CURL *hCurl; char *serverUrl = hsWStringToString(GetServerStatusUrl());
char *serverStatus = hsWStringToString(BuildTypeServerStatusPath()); CURL * hCurl = curl_easy_init();
char serverUrl[256];
snprintf(serverUrl, 256, "http://support.cyanworlds.com%s", serverStatus);
delete [] serverStatus;
hCurl = curl_easy_init();
curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, s_curlError); curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, s_curlError);
// update while we are running // update while we are running
while(!s_shutdown) while(!s_shutdown)
{ {
if(BuildTypeServerStatusPath()) curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0");
{ curl_easy_setopt(hCurl, CURLOPT_URL, serverUrl);
//TODO: Get a server status path from the server.ini, without
// pulling in all the annoying pfConsole dependencies.
// Alternatively, make a better launcher...
curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0"); if (serverUrl[0] && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
curl_easy_setopt(hCurl, CURLOPT_URL, serverUrl); SetStatusText(s_curlError);
if(StrLen(s_postKey))
{
char *safeData = curl_easy_escape(hCurl, s_postKey, strlen(s_postKey));
curl_easy_setopt(hCurl, CURLOPT_POST, 1);
curl_easy_setopt(hCurl, CURLOPT_POSTFIELDS, safeData);
curl_free(safeData);
}
if (curl_easy_perform(hCurl) != 0)
SetStatusText(s_curlError);
}
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && !s_shutdown; ++i) for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && !s_shutdown; ++i)
{ {
@ -646,6 +626,7 @@ static void StatusCallback(void *)
} }
curl_easy_cleanup(hCurl); curl_easy_cleanup(hCurl);
delete [] serverUrl;
s_statusEvent.Signal(); s_statusEvent.Signal();
} }

View File

@ -137,9 +137,9 @@ void SetGateKeeperSrvHostname (const wchar addr[]) {
//============================================================================ //============================================================================
// User-visible Server // User-visible Server
//============================================================================ //============================================================================
static wchar s_serverStatusUrl[256]; static wchar s_serverStatusUrl[256] = {0};
static wchar s_serverSignupUrl[256]; static wchar s_serverSignupUrl[256] = {0};
static wchar s_serverName[256]; static wchar s_serverName[256] = {0};
//============================================================================ //============================================================================
const wchar *GetServerStatusUrl () { const wchar *GetServerStatusUrl () {