diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 11:17:34 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 11:17:34 +0100 |
commit | 18ab8207bd14def950fd399c60d9ee54fab75d3b (patch) | |
tree | a82af333127184acc6be6e0969919cb20be5e8b3 /cpp/src/Ice/BatchRequestQueue.cpp | |
parent | Fixed ICE-7548 - getAdminProxy no longer returns 0 if synchronization is in p... (diff) | |
download | ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.bz2 ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.xz ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.zip |
Fixed ICE-7169 and ICE-7375 - add option to specify if batch requests flushed with the communicator/connection should be compressed
Diffstat (limited to 'cpp/src/Ice/BatchRequestQueue.cpp')
-rw-r--r-- | cpp/src/Ice/BatchRequestQueue.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/cpp/src/Ice/BatchRequestQueue.cpp b/cpp/src/Ice/BatchRequestQueue.cpp index 5eb2758b00e..50b69a5436e 100644 --- a/cpp/src/Ice/BatchRequestQueue.cpp +++ b/cpp/src/Ice/BatchRequestQueue.cpp @@ -10,6 +10,7 @@ #include <Ice/BatchRequestQueue.h> #include <Ice/Instance.h> #include <Ice/Properties.h> +#include <Ice/Reference.h> using namespace std; using namespace Ice; @@ -34,7 +35,7 @@ public: virtual void enqueue() const { - _queue.enqueueBatchRequest(); + _queue.enqueueBatchRequest(_proxy); } virtual int @@ -70,6 +71,7 @@ BatchRequestQueue::BatchRequestQueue(const InstancePtr& instance, bool datagram) _batchStream(instance.get(), Ice::currentProtocolEncoding), _batchStreamInUse(false), _batchStreamCanFlush(false), + _batchCompress(false), _batchRequestNum(0) { _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr)); @@ -101,7 +103,9 @@ BatchRequestQueue::prepareBatchRequest(OutputStream* os) } void -BatchRequestQueue::finishBatchRequest(OutputStream* os, const Ice::ObjectPrxPtr& proxy, const std::string& operation) +BatchRequestQueue::finishBatchRequest(OutputStream* os, + const Ice::ObjectPrxPtr& proxy, + const std::string& operation) { // // No need for synchronization, no other threads are supposed @@ -135,6 +139,11 @@ BatchRequestQueue::finishBatchRequest(OutputStream* os, const Ice::ObjectPrxPtr& } else { + bool compress; + if(proxy->_getReference()->getCompressOverride(compress)) + { + _batchCompress |= compress; + } _batchMarker = _batchStream.b.size(); ++_batchRequestNum; } @@ -170,7 +179,7 @@ BatchRequestQueue::abortBatchRequest(OutputStream* os) } int -BatchRequestQueue::swap(OutputStream* os) +BatchRequestQueue::swap(OutputStream* os, bool& compress) { Lock sync(*this); if(_batchRequestNum == 0) @@ -189,11 +198,13 @@ BatchRequestQueue::swap(OutputStream* os) int requestNum = _batchRequestNum; _batchStream.swap(*os); + compress = _batchCompress; // // Reset the batch. // _batchRequestNum = 0; + _batchCompress = false; _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr)); _batchMarker = _batchStream.b.size(); if(!lastRequest.empty()) @@ -231,9 +242,14 @@ BatchRequestQueue::waitStreamInUse(bool flush) } void -BatchRequestQueue::enqueueBatchRequest() +BatchRequestQueue::enqueueBatchRequest(const Ice::ObjectPrxPtr& proxy) { assert(_batchMarker < _batchStream.b.size()); + bool compress; + if(proxy->_getReference()->getCompressOverride(compress)) + { + _batchCompress |= compress; + } _batchMarker = _batchStream.b.size(); ++_batchRequestNum; } |