Still trying to make it work on linux.
This commit is contained in:
@@ -258,7 +258,7 @@ ClientStateStartServerListDownload::Process(ClientThread &client)
|
|||||||
tmpServerListPath /= "serverlist.xml.z";
|
tmpServerListPath /= "serverlist.xml.z";
|
||||||
|
|
||||||
std::auto_ptr<DownloadHelper> downloader(new DownloadHelper);
|
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());
|
ClientStateDownloadingServerList::Instance().SetDownloadHelper(downloader.release());
|
||||||
client.SetState(ClientStateDownloadingServerList::Instance());
|
client.SetState(ClientStateDownloadingServerList::Instance());
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ DownloadHelper::Init(const string &url, const string &targetFileName)
|
|||||||
{
|
{
|
||||||
m_data->targetFile = fopen(targetFileName.c_str(), "wb");
|
m_data->targetFile = fopen(targetFileName.c_str(), "wb");
|
||||||
m_data->curlHandle = curl_easy_init();
|
m_data->curlHandle = curl_easy_init();
|
||||||
m_data->curlMultiHandle = curl_multi_init();
|
//m_data->curlMultiHandle = curl_multi_init();
|
||||||
|
|
||||||
// TODO throw exception on error
|
// 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_WRITEFUNCTION, NULL);
|
||||||
curl_easy_setopt(m_data->curlHandle, CURLOPT_WRITEDATA, m_data->targetFile);
|
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
|
bool
|
||||||
DownloadHelper::Process()
|
DownloadHelper::Process()
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
/*bool retVal = false;
|
||||||
int runningHandles = 0;
|
int runningHandles = 0;
|
||||||
CURLMcode curlResult;
|
CURLMcode curlResult;
|
||||||
do
|
do
|
||||||
@@ -102,7 +102,9 @@ DownloadHelper::Process()
|
|||||||
Cleanup();
|
Cleanup();
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;*/
|
||||||
|
curl_easy_perform(m_data->curlHandle);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -120,6 +122,7 @@ DownloadHelper::Cleanup()
|
|||||||
}
|
}
|
||||||
if (m_data->targetFile)
|
if (m_data->targetFile)
|
||||||
{
|
{
|
||||||
|
fflush(m_data->targetFile);
|
||||||
fclose(m_data->targetFile);
|
fclose(m_data->targetFile);
|
||||||
m_data->targetFile = NULL;
|
m_data->targetFile = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user