https downloader timeout on win/mac (#18935)

This commit is contained in:
Arnold 2018-08-31 10:12:04 +08:00 committed by minggo
parent 925b727bb1
commit f99c81c336
1 changed files with 8 additions and 3 deletions

View File

@ -39,6 +39,8 @@
// member function with suffix "Proc" designed called in DownloaderCURL::_threadProc
// 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 {
using namespace std;
@ -381,11 +383,14 @@ namespace cocos2d { namespace network {
}
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_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)
{
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true);
@ -508,7 +513,7 @@ namespace cocos2d { namespace network {
// do wait action
if(maxfd == -1)
{
this_thread::sleep_for(chrono::milliseconds(timeoutMS));
this_thread::sleep_for(chrono::milliseconds(CC_CURL_POLL_TIMEOUT_MS));
rc = 0;
}
else