From cf51baa49616d92dc1863f520aa38dba02a54a34 Mon Sep 17 00:00:00 2001 From: Michi Henning Date: Fri, 25 Feb 2005 05:09:16 +0000 Subject: Changed _chunkSize to use kilobyte units and limited _chunkSize by MessageSizeMax. --- cpp/src/IcePatch2/ClientUtil.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'cpp/src/IcePatch2/ClientUtil.cpp') diff --git a/cpp/src/IcePatch2/ClientUtil.cpp b/cpp/src/IcePatch2/ClientUtil.cpp index 9916404b2bd..fcfb2c0ce94 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(simplify(communicator->getProperties()->getPropertyWithDefault("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,10 +152,27 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe throw string("no data directory specified"); } + // + // Make sure that _chunkSize doesn't exceed MessageSizeMax, otherwise + // it won't work at all. + // + int sizeMax = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024); if(_chunkSize < 1) { const_cast(_chunkSize) = 1; } + else if(_chunkSize > sizeMax) + { + const_cast(_chunkSize) = sizeMax; + } + if(_chunkSize == sizeMax) + { + const_cast(_chunkSize) = _chunkSize * 1024 - 512; // Leave some headroom for protocol header. + } + else + { + const_cast(_chunkSize) *= 1024; + } if(!isAbsolute(_dataDir)) { -- cgit v1.2.3