Fix HTTP unit test.
Also fix a signed/unsigned warning I caused.
This commit is contained in:
parent
7a7fcf10ad
commit
f367627cac
@ -808,12 +808,13 @@ void Client::makeRequest(const Request_ptr& r)
|
||||
ss << host << "-" << port;
|
||||
string connectionId = ss.str();
|
||||
bool havePending = !d->pendingRequests.empty();
|
||||
ConnectionDict::iterator consEnd = d->connections.end();
|
||||
|
||||
// assign request to an existing Connection.
|
||||
// various options exist here, examined in order
|
||||
if (d->connections.size() >= d->maxConnections) {
|
||||
ConnectionDict::iterator it = d->connections.find(connectionId);
|
||||
if (it == d->connections.end()) {
|
||||
if (it == consEnd) {
|
||||
// maximum number of connections active, queue this request
|
||||
// when a connection goes inactive, we'll start this one
|
||||
d->pendingRequests.push_back(r);
|
||||
@ -828,7 +829,7 @@ void Client::makeRequest(const Request_ptr& r)
|
||||
// there's pressure on the number of connections to keep alive, one
|
||||
// host can't DoS every other.
|
||||
int count = 0;
|
||||
for (;it->first == connectionId; ++it, ++count) {
|
||||
for (; (it != consEnd) && (it->first == connectionId); ++it, ++count) {
|
||||
if (havePending || !it->second->isActive()) {
|
||||
con = it->second;
|
||||
break;
|
||||
|
@ -477,6 +477,8 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
HTTP::Client cl;
|
||||
// force all requests to use the same connection for this test
|
||||
cl.setMaxConnections(1);
|
||||
|
||||
// test URL parsing
|
||||
TestRequest* tr1 = new TestRequest("http://localhost.woo.zar:2000/test1?foo=bar");
|
||||
@ -657,6 +659,7 @@ int main(int argc, char* argv[])
|
||||
cout << "testing HTTP 1.1 pipelineing" << endl;
|
||||
|
||||
{
|
||||
|
||||
cl.setProxy("", 80);
|
||||
TestRequest* tr = new TestRequest("http://localhost:2000/test1");
|
||||
HTTP::Request_ptr own(tr);
|
||||
|
@ -773,7 +773,7 @@ void SGTerraSync::SvnThread::initCompletedTilesPersistentCache()
|
||||
time_t now = time(0);
|
||||
|
||||
readProperties(_persistentCachePath.str(), cacheRoot);
|
||||
for (unsigned int i=0; i<cacheRoot->nChildren(); ++i) {
|
||||
for (int i=0; i<cacheRoot->nChildren(); ++i) {
|
||||
SGPropertyNode* entry = cacheRoot->getChild(i);
|
||||
string tileName = entry->getStringValue("path");
|
||||
time_t stamp = entry->getIntValue("stamp");
|
||||
|
Loading…
Reference in New Issue
Block a user