summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2004-06-28 21:02:58 +0000
committerMarc Laukien <marc@zeroc.com>2004-06-28 21:02:58 +0000
commitfc70a0e50510c4c630e2b2974d02a121713b988d (patch)
tree4301639291abe374be826e83d002bae9cf1da996 /cpp
parentCosmetic fixes. (diff)
downloadice-fc70a0e50510c4c630e2b2974d02a121713b988d.tar.bz2
ice-fc70a0e50510c4c630e2b2974d02a121713b988d.tar.xz
ice-fc70a0e50510c4c630e2b2974d02a121713b988d.zip
compression fix
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Outgoing.h4
-rw-r--r--cpp/include/Ice/OutgoingAsync.h1
-rw-r--r--cpp/include/Ice/Proxy.h1
-rw-r--r--cpp/src/Ice/Connection.cpp113
-rw-r--r--cpp/src/Ice/Connection.h7
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp72
-rw-r--r--cpp/src/Ice/ConnectionFactory.h2
-rw-r--r--cpp/src/Ice/Outgoing.cpp12
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp6
-rw-r--r--cpp/src/Ice/Proxy.cpp13
-rw-r--r--cpp/src/Ice/Reference.cpp5
-rw-r--r--cpp/src/Ice/Reference.h2
-rw-r--r--cpp/src/Ice/TraceUtil.cpp6
-rw-r--r--cpp/src/IcePatch/IcePatchI.cpp9
-rw-r--r--cpp/src/slice2cpp/Gen.cpp2
15 files changed, 135 insertions, 120 deletions
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 8d91bfaacf7..1673859a088 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -51,7 +51,7 @@ class ICE_API Outgoing : public ::IceUtil::noncopyable, public IceUtil::Monitor<
{
public:
- Outgoing(Connection*, Reference*, const std::string&, ::Ice::OperationMode, const ::Ice::Context&);
+ Outgoing(Connection*, Reference*, const std::string&, ::Ice::OperationMode, const ::Ice::Context&, bool);
bool invoke(); // Returns true if ok, false if user exception.
void finished(BasicStream&);
@@ -83,6 +83,8 @@ private:
BasicStream _is;
BasicStream _os;
+
+ const bool _compress;
};
}
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index 1cc4673a422..98256d93fb8 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -60,6 +60,7 @@ private:
ConnectionPtr _connection;
int _cnt;
Ice::OperationMode _mode;
+ bool _compress;
IceUtil::Monitor<IceUtil::RecMutex> _monitor;
};
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 916bfc000be..7482a3fce74 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -187,6 +187,7 @@ protected:
::IceInternal::ReferencePtr __reference;
::IceInternal::ConnectionPtr __connection;
+ bool __compress;
private:
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 79e3915cb83..eeec4f100e0 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -57,7 +57,7 @@ IceInternal::Connection::validate()
os.write(encodingMajor);
os.write(encodingMinor);
os.write(validateConnectionMsg);
- os.write((Byte)1); // Compression status.
+ os.write(static_cast<Byte>(1)); // Compression status.
os.write(headerSize); // Message size.
os.i = os.b.begin();
traceHeader("sending validate connection", os, _logger, _traceLevels);
@@ -358,7 +358,7 @@ IceInternal::Connection::prepareRequest(BasicStream* os)
}
void
-IceInternal::Connection::sendRequest(BasicStream* os, Outgoing* out)
+IceInternal::Connection::sendRequest(BasicStream* os, Outgoing* out, bool compress)
{
Int requestId;
@@ -422,22 +422,12 @@ IceInternal::Connection::sendRequest(BasicStream* os, Outgoing* out)
_exception->ice_throw(); // The exception is immutable at this point.
}
- bool compress;
- if(os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
- {
- compress = false;
- }
- else
- {
- compress = _endpoint->compress();
- }
-
- if(compress)
+ if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
{
//
- // Set compression status.
+ // Message compressed, request compressed response.
//
- os->b[9] = 2; // Message is compressed.
+ os->b[9] = 2;
//
// Do compression.
@@ -455,6 +445,14 @@ IceInternal::Connection::sendRequest(BasicStream* os, Outgoing* out)
}
else
{
+ if(out && compress)
+ {
+ //
+ // Message not compressed, but request compressed response.
+ //
+ os->b[9] = 1;
+ }
+
//
// No compression, just fill in the message size.
//
@@ -520,7 +518,7 @@ IceInternal::Connection::sendRequest(BasicStream* os, Outgoing* out)
}
void
-IceInternal::Connection::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPtr& out)
+IceInternal::Connection::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPtr& out, bool compress)
{
Int requestId;
@@ -585,23 +583,13 @@ IceInternal::Connection::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPt
_exception->ice_throw(); // The exception is immutable at this point.
}
- bool compress;
- if(os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
- {
- compress = false;
- }
- else
- {
- compress = _endpoint->compress();
- }
-
- if(compress)
+ if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
{
//
- // Set compression status.
+ // Message compressed, request compressed response.
//
- os->b[9] = 2; // Message is compressed.
-
+ os->b[9] = 2;
+
//
// Do compression.
//
@@ -618,6 +606,14 @@ IceInternal::Connection::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPt
}
else
{
+ if(compress)
+ {
+ //
+ // Message not compressed, but request compressed response.
+ //
+ os->b[9] = 1;
+ }
+
//
// No compression, just fill in the message size.
//
@@ -719,7 +715,7 @@ IceInternal::Connection::prepareBatchRequest(BasicStream* os)
}
void
-IceInternal::Connection::finishBatchRequest(BasicStream* os)
+IceInternal::Connection::finishBatchRequest(BasicStream* os, bool compress)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
@@ -735,6 +731,15 @@ IceInternal::Connection::finishBatchRequest(BasicStream* os)
++_batchRequestNum; // Increment the number of requests in the batch.
//
+ // We compress the whole batch if there is at least one compressed
+ // message.
+ //
+ if(compress)
+ {
+ _batchRequestCompress = true;
+ }
+
+ //
// Give the Connection back.
//
assert(_batchStreamInUse);
@@ -800,22 +805,12 @@ IceInternal::Connection::flushBatchRequest()
copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize);
#endif
- bool compress;
- if(_batchStream.b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
- {
- compress = false;
- }
- else
- {
- compress = _endpoint->compress();
- }
-
- if(compress)
+ if(_batchRequestCompress && _batchStream.b.size() >= 100) // Only compress messages larger than 100 bytes.
{
//
- // Set compression status.
+ // Message compressed, request compressed response.
//
- _batchStream.b[9] = 2; // Message is compressed.
+ _batchStream.b[9] = 2;
//
// Do compression.
@@ -875,6 +870,7 @@ IceInternal::Connection::flushBatchRequest()
_batchStream.swap(dummy);
assert(_batchStream.b.empty());
_batchRequestNum = 0;
+ _batchRequestCompress = false;
_batchStreamInUse = false;
notifyAll();
}
@@ -893,23 +889,17 @@ IceInternal::Connection::sendResponse(BasicStream* os, Byte compressFlag)
_exception->ice_throw(); // The exception is immutable at this point.
}
- bool compress;
- if(os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
- {
- compress = false;
- }
- else
- {
- compress = _endpoint->compress() && compressFlag > 0;
- }
-
- if(compress)
+ //
+ // Only compress if compression was requested by the client,
+ // and if the message is larger than 100 bytes.
+ //
+ if(compressFlag > 0 && os->b.size() >= 100)
{
//
- // Set compression status.
+ // Response is compressed.
//
- os->b[9] = 2; // Message is compressed.
-
+ os->b[9] = 2;
+
//
// Do compression.
//
@@ -1484,6 +1474,7 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
_batchStream(_instance.get()),
_batchStreamInUse(false),
_batchRequestNum(0),
+ _batchRequestCompress(false),
_dispatchCount(0),
_state(StateNotValidated),
_stateTime(IceUtil::Time::now())
@@ -1509,7 +1500,7 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
requestHdr[6] = encodingMajor;
requestHdr[7] = encodingMinor;
requestHdr[8] = requestMsg;
- requestHdr[9] = 1; // Default compression status: compression supported but not used.
+ requestHdr[9] = 0;
vector<Byte>& requestBatchHdr = const_cast<vector<Byte>&>(_requestBatchHdr);
requestBatchHdr[0] = magic[0];
@@ -1521,7 +1512,7 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
requestBatchHdr[6] = encodingMajor;
requestBatchHdr[7] = encodingMinor;
requestBatchHdr[8] = requestBatchMsg;
- requestBatchHdr[9] = 1; // Default compression status: compression supported but not used.
+ requestBatchHdr[9] = 0;
vector<Byte>& replyHdr = const_cast<vector<Byte>&>(_replyHdr);
replyHdr[0] = magic[0];
@@ -1533,7 +1524,7 @@ IceInternal::Connection::Connection(const InstancePtr& instance,
replyHdr[6] = encodingMajor;
replyHdr[7] = encodingMinor;
replyHdr[8] = replyMsg;
- replyHdr[9] = 1; // Default compression status: compression supported but not used.
+ replyHdr[9] = 0;
}
IceInternal::Connection::~Connection()
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index e70b9a000d8..c9a3250ac2d 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -61,11 +61,11 @@ public:
void monitor();
void prepareRequest(BasicStream*);
- void sendRequest(BasicStream*, Outgoing*);
- void sendAsyncRequest(BasicStream*, const OutgoingAsyncPtr&);
+ void sendRequest(BasicStream*, Outgoing*, bool);
+ void sendAsyncRequest(BasicStream*, const OutgoingAsyncPtr&, bool);
void prepareBatchRequest(BasicStream*);
- void finishBatchRequest(BasicStream*);
+ void finishBatchRequest(BasicStream*, bool);
void flushBatchRequest();
void sendResponse(BasicStream*, Ice::Byte);
@@ -162,6 +162,7 @@ private:
BasicStream _batchStream;
bool _batchStreamInUse;
int _batchRequestNum;
+ bool _batchRequestCompress;
int _dispatchCount;
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index ab66c0528f3..231632a6fcc 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -94,7 +94,7 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
}
ConnectionPtr
-IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts)
+IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts, bool& compress)
{
assert(!endpts.empty());
vector<EndpointPtr> endpoints = endpts;
@@ -135,32 +135,40 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
*q = (*q)->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
- if(defaultsAndOverrides->overrideCompress)
- {
- *q = (*q)->compress(defaultsAndOverrides->overrideCompressValue);
- }
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ *q = (*q)->compress(false);
}
//
// Search for existing connections.
//
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ vector<EndpointPtr>::const_iterator r;
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q);
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
- while(r.first != r.second)
+ while(pr.first != pr.second)
{
//
// Don't return connections for which destruction has
// been initiated.
//
- if(!r.first->second->isDestroyed())
+ if(!pr.first->second->isDestroyed())
{
- return r.first->second;
+ compress = (*r)->compress();
+ return pr.first->second;
}
- ++r.first;
+ ++pr.first;
}
}
@@ -201,23 +209,24 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
//
if(searchAgain)
{
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q);
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
- while(r.first != r.second)
+ while(pr.first != pr.second)
{
//
// Don't return connections for which destruction has
// been initiated.
//
- if(!r.first->second->isDestroyed())
+ if(!pr.first->second->isDestroyed())
{
- return r.first->second;
+ compress = (*r)->compress();
+ return pr.first->second;
}
- ++r.first;
+ ++pr.first;
}
}
}
@@ -235,7 +244,8 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
auto_ptr<LocalException> exception;
vector<EndpointPtr>::const_iterator q;
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ vector<EndpointPtr>::const_iterator r;
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
EndpointPtr endpoint = *q;
@@ -266,6 +276,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
}
connection = new Connection(_instance, transceiver, endpoint, 0);
connection->validate();
+ compress = (*r)->compress();
break;
}
catch(const LocalException& ex)
@@ -357,23 +368,32 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
{
EndpointPtr endpoint = *p;
+ //
+ // Modify endpoints with overrides.
+ //
if(defaultsAndOverrides->overrideTimeout)
{
endpoint = endpoint->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
- if(defaultsAndOverrides->overrideCompress)
- {
- endpoint = endpoint->compress(defaultsAndOverrides->overrideCompressValue);
- }
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ endpoint = endpoint->compress(false);
pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(endpoint);
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(endpoint);
- while(r.first != r.second)
+ while(pr.first != pr.second)
{
- r.first->second->setAdapter(adapter);
- ++r.first;
+ pr.first->second->setAdapter(adapter);
+ ++pr.first;
}
}
}
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index 45870124540..a1e151aa6b1 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -43,7 +43,7 @@ public:
void waitUntilFinished();
- ConnectionPtr create(const std::vector<EndpointPtr>&);
+ ConnectionPtr create(const std::vector<EndpointPtr>&, bool&);
void setRouter(const ::Ice::RouterPrx&);
void removeAdapter(const ::Ice::ObjectAdapterPtr&);
void flushBatchRequests();
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 1b0cb1a9f3a..f61f5494519 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -11,6 +11,7 @@
#include <Ice/Object.h>
#include <Ice/Connection.h>
#include <Ice/Reference.h>
+#include <Ice/Endpoint.h>
#include <Ice/LocalException.h>
using namespace std;
@@ -35,12 +36,13 @@ IceInternal::NonRepeatable::get() const
}
IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context& context) :
+ OperationMode mode, const Context& context, bool compress) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
_is(ref->instance.get()),
- _os(ref->instance.get())
+ _os(ref->instance.get()),
+ _compress(compress)
{
switch(_reference->mode)
{
@@ -113,7 +115,7 @@ IceInternal::Outgoing::invoke()
// this object, so we don't need to lock the mutex, keep
// track of state, or save exceptions.
//
- _connection->sendRequest(&_os, this);
+ _connection->sendRequest(&_os, this, _compress);
//
// Wait until the request has completed, or until the
@@ -220,7 +222,7 @@ IceInternal::Outgoing::invoke()
// propagate to the caller, because such exceptions can be
// retried without violating "at-most-once".
//
- _connection->sendRequest(&_os, 0);
+ _connection->sendRequest(&_os, 0, _compress);
break;
}
@@ -232,7 +234,7 @@ IceInternal::Outgoing::invoke()
// regular oneways and datagrams (see comment above)
// apply.
//
- _connection->finishBatchRequest(&_os);
+ _connection->finishBatchRequest(&_os, _compress);
break;
}
}
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index ecef9ed15cb..3cfa59968d5 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -287,7 +287,7 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat
_reference = prx->__reference();
assert(!_connection);
- _connection = _reference->getConnection();
+ _connection = _reference->getConnection(_compress);
_cnt = 0;
_mode = mode;
assert(!__is);
@@ -353,12 +353,12 @@ IceInternal::OutgoingAsync::__send()
{
if(!_connection)
{
- _connection = _reference->getConnection();
+ _connection = _reference->getConnection(_compress);
}
try
{
- _connection->sendAsyncRequest(__os, this);
+ _connection->sendAsyncRequest(__os, this, _compress);
//
// Don't do anything after sendAsyncRequest() returned
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index f8d2aa9f389..64ed2612736 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -748,7 +748,7 @@ bool
IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
static const string __operation("ice_isA");
- Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
BasicStream* __is = __out.is();
BasicStream* __os = __out.os();
__os->write(__id);
@@ -772,7 +772,7 @@ void
IceDelegateM::Ice::Object::ice_ping(const Context& __context)
{
static const string __operation("ice_ping");
- Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
BasicStream* __is = __out.is();
try
{
@@ -791,7 +791,7 @@ vector<string>
IceDelegateM::Ice::Object::ice_ids(const Context& __context)
{
static const string __operation("ice_ids");
- Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
BasicStream* __is = __out.is();
vector<string> __ret;
try
@@ -813,7 +813,7 @@ string
IceDelegateM::Ice::Object::ice_id(const Context& __context)
{
static const string __operation("ice_id");
- Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
+ Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context, __compress);
BasicStream* __is = __out.is();
string __ret;
try
@@ -838,7 +838,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
vector<Byte>& outParams,
const Context& context)
{
- Outgoing __out(__connection.get(), __reference.get(), operation, mode, context);
+ Outgoing __out(__connection.get(), __reference.get(), operation, mode, context, __compress);
BasicStream* __os = __out.os();
__os->writeBlob(inParams);
bool ok = __out.invoke();
@@ -876,6 +876,7 @@ IceDelegateM::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate
__reference = from->__reference;
__connection = from->__connection;
+ __compress = from->__compress;
}
void
@@ -890,7 +891,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
assert(!__connection);
__reference = ref;
- __connection = __reference->getConnection();
+ __connection = __reference->getConnection(__compress);
}
bool
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 6752226703c..e8df567dede 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -641,7 +641,7 @@ IceInternal::Reference::changeDefault() const
}
ConnectionPtr
-IceInternal::Reference::getConnection() const
+IceInternal::Reference::getConnection(bool& compress) const
{
ConnectionPtr connection;
@@ -678,6 +678,7 @@ IceInternal::Reference::getConnection() const
}
assert(p != connections.end());
connection = *p;
+ compress = (*p)->endpoint()->compress();
}
else
{
@@ -716,7 +717,7 @@ IceInternal::Reference::getConnection() const
try
{
OutgoingConnectionFactoryPtr factory = instance->outgoingConnectionFactory();
- connection = factory->create(filteredEndpts);
+ connection = factory->create(filteredEndpts, compress);
assert(connection);
}
catch(const LocalException& ex)
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 281067adbcb..64f6cfde9ec 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -94,7 +94,7 @@ public:
//
// Get a suitable connection for this reference.
//
- ConnectionPtr getConnection() const;
+ ConnectionPtr getConnection(bool&) const;
//
// Filter endpoints based on criteria from this reference.
diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp
index 9ef1a346074..8c89392063c 100644
--- a/cpp/src/Ice/TraceUtil.cpp
+++ b/cpp/src/Ice/TraceUtil.cpp
@@ -143,19 +143,19 @@ printHeader(ostream& s, BasicStream& stream)
{
case 0:
{
- s << "(compression not supported)";
+ s << "(not compressed; do not compress response, if any)";
break;
}
case 1:
{
- s << "(not compressed)";
+ s << "(not compressed; compress response, if any)";
break;
}
case 2:
{
- s << "(compressed)";
+ s << "(compressed; compress response, if any)";
break;
}
diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp
index 296c90b396b..96837f7c1a9 100644
--- a/cpp/src/IcePatch/IcePatchI.cpp
+++ b/cpp/src/IcePatch/IcePatchI.cpp
@@ -108,12 +108,7 @@ IcePatch::DirectoryI::describe(const Current& current) const
// No mutex lock necessary.
DirectoryDescPtr desc = new DirectoryDesc;
desc->md5 = readMD5(current);
-
- //
- // We want compression for directories, to compress directory
- // listings on the fly.
- //
- desc->dir = DirectoryPrx::uncheckedCast(_adapter->createProxy(current.id));//->ice_compress(true));
+ desc->dir = DirectoryPrx::uncheckedCast(_adapter->createProxy(current.id));
return desc;
}
@@ -244,7 +239,7 @@ IcePatch::RegularI::describe(const Current& current) const
// We do not want compression for regular files, because we
// download pre-compressed files.
//
- desc->reg = RegularPrx::uncheckedCast(_adapter->createProxy(current.id));//->ice_compress(false));
+ desc->reg = RegularPrx::uncheckedCast(_adapter->createProxy(current.id)->ice_compress(false));
return desc;
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 1df742d1c5a..2cb5bfa7352 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1521,7 +1521,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "static const ::std::string __operation(\"" << p->name() << "\");";
C << nl << "::IceInternal::Outgoing __out(__connection.get(), __reference.get(), __operation, "
- << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);";
+ << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context, __compress);";
if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __os = __out.os();";