diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/IceGrid/AdminSessionI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/FileCache.cpp | 31 | ||||
-rw-r--r-- | cpp/test/IceGrid/activation/AllTests.cpp | 8 | ||||
-rw-r--r-- | cpp/test/IceGrid/deployer/application.xml | 3 |
5 files changed, 30 insertions, 16 deletions
diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp index 00f4439fb31..387a55c7533 100644 --- a/cpp/src/IceGrid/AdminSessionI.cpp +++ b/cpp/src/IceGrid/AdminSessionI.cpp @@ -28,7 +28,7 @@ FileIteratorI::FileIteratorI(const AdminSessionIPtr& session, _reader(reader), _filename(filename), _offset(offset), - _messageSizeMax(messageSizeMax) + _messageSizeMax(messageSizeMax - 256) // Room for the header { } diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 6ce57529e98..ba297e1c244 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -1764,7 +1764,7 @@ ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver for(PropertySetDescriptorDict::const_iterator p = _def.servicePropertySets.begin(); p != _def.servicePropertySets.end(); ++p) { - _instance.servicePropertySets.insert(make_pair(p->first, svrResolve(p->second))); + _instance.servicePropertySets.insert(make_pair(svrResolve(p->first), svrResolve(p->second))); } } diff --git a/cpp/src/IceGrid/FileCache.cpp b/cpp/src/IceGrid/FileCache.cpp index f6cbce81264..4f03160eeea 100644 --- a/cpp/src/IceGrid/FileCache.cpp +++ b/cpp/src/IceGrid/FileCache.cpp @@ -19,8 +19,8 @@ using namespace std; using namespace IceGrid; -FileCache::FileCache(const Ice::CommunicatorPtr& communicator) : - _messageSizeMax(communicator->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024) * 1024) +FileCache::FileCache(const Ice::CommunicatorPtr& com) : + _messageSizeMax(com->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024) * 1024 - 256) { } @@ -119,6 +119,11 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf size = _messageSizeMax; } + if(size <= 5) + { + throw FileNotAvailableException("maximum bytes per read request is too low"); + } + ifstream is(file.c_str()); if(is.fail()) { @@ -148,12 +153,28 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf #else is.seekg(static_cast<streampos>(offset)); #endif - int totalSize = 1024; // Some room for the message header. + int totalSize = 0; string line; - for(int i = 0; is.good() && totalSize < size; ++i) + for(int i = 0; is.good(); ++i) { getline(is, line); - totalSize += line.size() + 5; // 5 bytes for the encoding of the string size (worst case scenario) + int lineSize = line.size() + 5; // 5 bytes for the encoding of the string size (worst case scenario) + if(lineSize + totalSize > size) + { + if(size - totalSize - 5) // If there's some room left for a part of the string, return a partial string + { + line.substr(0, size - totalSize - 5); + lines.push_back(line); + newOffset += line.size(); + } + else + { + lines.push_back(""); + } + break; + } + + totalSize += lineSize; if(!is.fail()) { newOffset = is.tellg(); diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index 7d35d88e367..35879d0251b 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -493,14 +493,6 @@ allTests(const Ice::CommunicatorPtr& communicator) test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive); const int nThreads = 5; Ice::ObjectPrx proxy = communicator->stringToProxy("server-activation-timeout"); - try - { - proxy->ice_ping(); - } - catch(const Ice::LocalException& ex) - { - cerr << ex << endl; - } vector<PingThreadPtr> threads; threads.reserve(nThreads); vector<PingThreadPtr>::const_iterator p; diff --git a/cpp/test/IceGrid/deployer/application.xml b/cpp/test/IceGrid/deployer/application.xml index e9d6ad9e1c1..71f2765e7c7 100644 --- a/cpp/test/IceGrid/deployer/application.xml +++ b/cpp/test/IceGrid/deployer/application.xml @@ -44,6 +44,7 @@ <variable name="ObjectIdSlash" value="/"/> <variable name="ObjectName2" value="n2\/n2"/> <variable name="ObjectCategory2" value="c2\/c2"/> + <variable name="service4" value="Service4"/> <node name="localnode"> <description>NODE ${NodeVar}</description> @@ -76,7 +77,7 @@ <properties> <property name="IceBoxInstanceProperty" value="${name}"/> </properties> - <properties service="Service4"> + <properties service="${service4}"> <property name="IceBoxInstanceProperty" value="overriden"/> </properties> </server-instance> |