diff options
-rw-r--r-- | indra/llmessage/llcurl.cpp | 18 | ||||
-rw-r--r-- | indra/llmessage/llcurl.h | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 4 |
4 files changed, 38 insertions, 10 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 32a9cd061f..3bcaffc275 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -75,9 +75,6 @@ static const S32 MULTI_PERFORM_CALL_REPEAT = 5; static const S32 CURL_REQUEST_TIMEOUT = 30; // seconds per operation static const S32 MAX_ACTIVE_REQUEST_COUNT = 100; -static const F32 DEFAULT_MULTI_IDLE_TIME = 120.0f ; //seconds -static const S32 MAX_NUM_OF_HANDLES = 256 ; //max number of handles, (multi handles and easy handles combined). - // DEBUG // S32 gCurlEasyCount = 0; S32 gCurlMultiCount = 0; @@ -92,6 +89,8 @@ LLCurlThread* LLCurl::sCurlThread = NULL ; LLMutex* LLCurl::sHandleMutexp = NULL ; S32 LLCurl::sTotalHandles = 0 ; bool LLCurl::sNotQuitting = true; +F32 LLCurl::sCurlRequestTimeOut = 120.f; //seonds +S32 LLCurl::sMaxHandles = 256; //max number of handles, (multi handles and easy handles combined). void check_curl_code(CURLcode code) { @@ -573,9 +572,9 @@ LLCurl::Multi::Multi(F32 idle_time_out) LLCurl::getCurlThread()->addMulti(this) ; mIdleTimeOut = idle_time_out ; - if(mIdleTimeOut < DEFAULT_MULTI_IDLE_TIME) + if(mIdleTimeOut < LLCurl::sCurlRequestTimeOut) { - mIdleTimeOut = DEFAULT_MULTI_IDLE_TIME ; + mIdleTimeOut = LLCurl::sCurlRequestTimeOut ; } ++gCurlMultiCount; @@ -1442,8 +1441,11 @@ unsigned long LLCurl::ssl_thread_id(void) } #endif -void LLCurl::initClass(bool multi_threaded) +void LLCurl::initClass(F32 curl_reuest_timeout, S32 max_number_handles, bool multi_threaded) { + sCurlRequestTimeOut = curl_reuest_timeout ; //seconds + sMaxHandles = max_number_handles ; //max number of handles, (multi handles and easy handles combined). + // Do not change this "unless you are familiar with and mean to control // internal operations of libcurl" // - http://curl.haxx.se/libcurl/c/curl_global_init.html @@ -1512,7 +1514,7 @@ CURLM* LLCurl::newMultiHandle() { LLMutexLock lock(sHandleMutexp) ; - if(sTotalHandles + 1 > MAX_NUM_OF_HANDLES) + if(sTotalHandles + 1 > sMaxHandles) { llwarns << "no more handles available." << llendl ; return NULL ; //failed @@ -1545,7 +1547,7 @@ CURL* LLCurl::newEasyHandle() { LLMutexLock lock(sHandleMutexp) ; - if(sTotalHandles + 1 > MAX_NUM_OF_HANDLES) + if(sTotalHandles + 1 > sMaxHandles) { llwarns << "no more handles available." << llendl ; return NULL ; //failed diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 7d2340a6cb..fd664c0fa1 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -163,7 +163,7 @@ public: /** * @ brief Initialize LLCurl class */ - static void initClass(bool multi_threaded = false); + static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false); /** * @ brief Cleanup LLCurl class @@ -197,8 +197,10 @@ private: static LLMutex* sHandleMutexp ; static S32 sTotalHandles ; + static S32 sMaxHandles; public: static bool sNotQuitting; + static F32 sCurlRequestTimeOut; }; class LLCurl::Easy diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ea623791d..a29d5d2985 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1828,6 +1828,28 @@ <key>Value</key> <integer>0</integer> </map> + <key>CurlMaximumNumberOfHandles</key> + <map> + <key>Comment</key> + <string>Maximum number of handles curl can use (requires restart)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>256</integer> + </map> + <key>CurlRequestTimeOut</key> + <map> + <key>Comment</key> + <string>Max idle time of a curl request before killed (requires restart)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>120.0</real> + </map> <key>CurlUseMultipleThreads</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 40136adbc9..4fc306e61d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -720,7 +720,9 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. - LLCurl::initClass(gSavedSettings.getBOOL("CurlUseMultipleThreads")); + LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"), + gSavedSettings.getS32("CurlMaximumNumberOfHandles"), + gSavedSettings.getBOOL("CurlUseMultipleThreads")); LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ; LLMachineID::init(); |