Change CurlConcurrentConnectionsPerService to U16 and clamp it between 1 and 32.
Also fixes a bug where going from 1 to 2 would not update AIPerService::mConcurrectConnections correctly.
This commit is contained in:
@@ -49,7 +49,7 @@ AIThreadSafeSimpleDC<AIPerService::TotalQueued> AIPerService::sTotalQueued;
|
|||||||
namespace AICurlPrivate {
|
namespace AICurlPrivate {
|
||||||
|
|
||||||
// Cached value of CurlConcurrentConnectionsPerService.
|
// Cached value of CurlConcurrentConnectionsPerService.
|
||||||
U32 CurlConcurrentConnectionsPerService;
|
U16 CurlConcurrentConnectionsPerService;
|
||||||
|
|
||||||
// Friend functions of RefCountedThreadSafePerService
|
// Friend functions of RefCountedThreadSafePerService
|
||||||
|
|
||||||
@@ -473,8 +473,9 @@ void AIPerService::adjust_concurrent_connections(int increment)
|
|||||||
for (AIPerService::iterator iter = instance_map_w->begin(); iter != instance_map_w->end(); ++iter)
|
for (AIPerService::iterator iter = instance_map_w->begin(); iter != instance_map_w->end(); ++iter)
|
||||||
{
|
{
|
||||||
PerService_wat per_service_w(*iter->second);
|
PerService_wat per_service_w(*iter->second);
|
||||||
U32 old_concurrent_connections = per_service_w->mConcurrectConnections;
|
U16 old_concurrent_connections = per_service_w->mConcurrectConnections;
|
||||||
per_service_w->mConcurrectConnections = llclamp(old_concurrent_connections + increment, (U32)1, CurlConcurrentConnectionsPerService);
|
int new_concurrent_connections = llclamp(old_concurrent_connections + increment, 1, (int)CurlConcurrentConnectionsPerService);
|
||||||
|
per_service_w->mConcurrectConnections = (U16)new_concurrent_connections;
|
||||||
increment = per_service_w->mConcurrectConnections - old_concurrent_connections;
|
increment = per_service_w->mConcurrectConnections - old_concurrent_connections;
|
||||||
for (int i = 0; i < number_of_capability_types; ++i)
|
for (int i = 0; i < number_of_capability_types; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class RefCountedThreadSafePerService : public threadsafe_PerService {
|
|||||||
friend void intrusive_ptr_release(RefCountedThreadSafePerService* p);
|
friend void intrusive_ptr_release(RefCountedThreadSafePerService* p);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern U32 CurlConcurrentConnectionsPerService;
|
extern U16 CurlConcurrentConnectionsPerService;
|
||||||
|
|
||||||
} // namespace AICurlPrivate
|
} // namespace AICurlPrivate
|
||||||
|
|
||||||
|
|||||||
@@ -2561,7 +2561,7 @@ void startCurlThread(LLControlGroup* control_group)
|
|||||||
// Cache Debug Settings.
|
// Cache Debug Settings.
|
||||||
sConfigGroup = control_group;
|
sConfigGroup = control_group;
|
||||||
curl_max_total_concurrent_connections = sConfigGroup->getU32("CurlMaxTotalConcurrentConnections");
|
curl_max_total_concurrent_connections = sConfigGroup->getU32("CurlMaxTotalConcurrentConnections");
|
||||||
CurlConcurrentConnectionsPerService = sConfigGroup->getU32("CurlConcurrentConnectionsPerService");
|
CurlConcurrentConnectionsPerService = (U16)sConfigGroup->getU32("CurlConcurrentConnectionsPerService");
|
||||||
gNoVerifySSLCert = sConfigGroup->getBOOL("NoVerifySSLCert");
|
gNoVerifySSLCert = sConfigGroup->getBOOL("NoVerifySSLCert");
|
||||||
AIPerService::setMaxPipelinedRequests(curl_max_total_concurrent_connections);
|
AIPerService::setMaxPipelinedRequests(curl_max_total_concurrent_connections);
|
||||||
AIPerService::setHTTPThrottleBandwidth(sConfigGroup->getF32("HTTPThrottleBandwidth"));
|
AIPerService::setHTTPThrottleBandwidth(sConfigGroup->getF32("HTTPThrottleBandwidth"));
|
||||||
@@ -2586,10 +2586,19 @@ bool handleCurlConcurrentConnectionsPerService(LLSD const& newvalue)
|
|||||||
{
|
{
|
||||||
using namespace AICurlPrivate;
|
using namespace AICurlPrivate;
|
||||||
|
|
||||||
U32 new_concurrent_connections = newvalue.asInteger();
|
U16 new_concurrent_connections = (U16)newvalue.asInteger();
|
||||||
AIPerService::adjust_concurrent_connections(new_concurrent_connections - CurlConcurrentConnectionsPerService);
|
U16 const maxCurlConcurrentConnectionsPerService = 32;
|
||||||
CurlConcurrentConnectionsPerService = new_concurrent_connections;
|
if (new_concurrent_connections < 1 || new_concurrent_connections > maxCurlConcurrentConnectionsPerService)
|
||||||
llinfos << "CurlConcurrentConnectionsPerService set to " << CurlConcurrentConnectionsPerService << llendl;
|
{
|
||||||
|
sConfigGroup->setU32("CurlConcurrentConnectionsPerService", static_cast<U32>((new_concurrent_connections < 1) ? 1 : maxCurlConcurrentConnectionsPerService));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int increment = new_concurrent_connections - CurlConcurrentConnectionsPerService;
|
||||||
|
CurlConcurrentConnectionsPerService = new_concurrent_connections;
|
||||||
|
AIPerService::adjust_concurrent_connections(increment);
|
||||||
|
llinfos << "CurlConcurrentConnectionsPerService set to " << CurlConcurrentConnectionsPerService << llendl;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>U32</string>
|
<string>U32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>16</integer>
|
<integer>8</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>NoVerifySSLCert</key>
|
<key>NoVerifySSLCert</key>
|
||||||
<map>
|
<map>
|
||||||
|
|||||||
Reference in New Issue
Block a user