Still trying to make it work on linux.

This commit is contained in:
lotodore
2008-04-19 23:22:34 +00:00
parent 7d51a144dd
commit 01bd6cb1f8
2 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ ClientStateStartServerListDownload::Process(ClientThread &client)
tmpServerListPath /= "serverlist.xml.z";
std::auto_ptr<DownloadHelper> downloader(new DownloadHelper);
downloader->Init("http://pokerth.net/serverlist.xml.z", tmpServerListPath.directory_string());
downloader->Init("pokerth.net/serverlist.xml.z", tmpServerListPath.directory_string());
ClientStateDownloadingServerList::Instance().SetDownloadHelper(downloader.release());
client.SetState(ClientStateDownloadingServerList::Instance());
+7 -4
View File
@@ -51,7 +51,7 @@ DownloadHelper::Init(const string &url, const string &targetFileName)
{
m_data->targetFile = fopen(targetFileName.c_str(), "wb");
m_data->curlHandle = curl_easy_init();
m_data->curlMultiHandle = curl_multi_init();
//m_data->curlMultiHandle = curl_multi_init();
// TODO throw exception on error
@@ -59,13 +59,13 @@ DownloadHelper::Init(const string &url, const string &targetFileName)
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEDATA, m_data->targetFile);
curl_multi_add_handle(m_data->curlMultiHandle, m_data->curlHandle);
//curl_multi_add_handle(m_data->curlMultiHandle, m_data->curlHandle);
}
bool
DownloadHelper::Process()
{
bool retVal = false;
/*bool retVal = false;
int runningHandles = 0;
CURLMcode curlResult;
do
@@ -102,7 +102,9 @@ DownloadHelper::Process()
Cleanup();
retVal = true;
}
return retVal;
return retVal;*/
curl_easy_perform(m_data->curlHandle);
return true;
}
void
@@ -120,6 +122,7 @@ DownloadHelper::Cleanup()
}
if (m_data->targetFile)
{
fflush(m_data->targetFile);
fclose(m_data->targetFile);
m_data->targetFile = NULL;
}