mirror of https://github.com/axmolengine/axmol.git
https downloader timeout on win/mac (#18935)
This commit is contained in:
parent
925b727bb1
commit
f99c81c336
|
@ -39,6 +39,8 @@
|
||||||
// member function with suffix "Proc" designed called in DownloaderCURL::_threadProc
|
// member function with suffix "Proc" designed called in DownloaderCURL::_threadProc
|
||||||
// member function without suffix designed called in main thread
|
// member function without suffix designed called in main thread
|
||||||
|
|
||||||
|
#define CC_CURL_POLL_TIMEOUT_MS 50 //wait until DNS query done
|
||||||
|
|
||||||
namespace cocos2d { namespace network {
|
namespace cocos2d { namespace network {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -381,11 +383,14 @@ namespace cocos2d { namespace network {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const long LOW_SPEED_LIMIT = 1;
|
static const long LOW_SPEED_LIMIT = 1;
|
||||||
static const long LOW_SPEED_TIME = 5;
|
static const long LOW_SPEED_TIME = 10;
|
||||||
curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT);
|
curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, LOW_SPEED_LIMIT);
|
||||||
curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME);
|
curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, LOW_SPEED_TIME);
|
||||||
|
|
||||||
static const int MAX_REDIRS = 2;
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
|
||||||
|
static const int MAX_REDIRS = 5;
|
||||||
if (MAX_REDIRS)
|
if (MAX_REDIRS)
|
||||||
{
|
{
|
||||||
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true);
|
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
@ -508,7 +513,7 @@ namespace cocos2d { namespace network {
|
||||||
// do wait action
|
// do wait action
|
||||||
if(maxfd == -1)
|
if(maxfd == -1)
|
||||||
{
|
{
|
||||||
this_thread::sleep_for(chrono::milliseconds(timeoutMS));
|
this_thread::sleep_for(chrono::milliseconds(CC_CURL_POLL_TIMEOUT_MS));
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue