diff options
Diffstat (limited to 'cpp/src/IcePatch2/ClientUtil.cpp')
-rwxr-xr-x | cpp/src/IcePatch2/ClientUtil.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cpp/src/IcePatch2/ClientUtil.cpp b/cpp/src/IcePatch2/ClientUtil.cpp index 42ac384b4ef..6c392ba5d51 100755 --- a/cpp/src/IcePatch2/ClientUtil.cpp +++ b/cpp/src/IcePatch2/ClientUtil.cpp @@ -144,7 +144,7 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe _feedback(feedback), _dataDir(normalize(communicator->getProperties()->getProperty("IcePatch2.Directory"))), _thorough(communicator->getProperties()->getPropertyAsInt("IcePatch2.Thorough") > 0), - _chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100000)), + _chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100)), _remove(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.Remove", 1)) { if(_dataDir.empty()) @@ -152,9 +152,22 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe throw string("no data directory specified"); } - if(_chunkSize < 1024) + int sizeMax = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024); + if(_chunkSize < 1) { - const_cast<Int&>(_chunkSize) = 1024; + const_cast<Int&>(_chunkSize) = 1; + } + else if(_chunkSize > sizeMax) + { + _chunkSize = sizeMax; + } + if(_chunkSize == sizeMax) + { + _chunkSize = _chunkSize * 1024 - 512; // Leave some headroom for protocol header. + } + else + { + _chunkSize *= 1024; } PropertiesPtr properties = communicator->getProperties(); |