diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/config/TestUtil.py | 13 | ||||
-rw-r--r-- | cpp/doc/Properties.sgml | 32 | ||||
-rw-r--r-- | cpp/src/Ice/Connection.cpp | 33 | ||||
-rw-r--r-- | cpp/src/Ice/Connection.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 41 |
5 files changed, 108 insertions, 13 deletions
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index 2d33e643a4d..89a4cf383fa 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -20,6 +20,14 @@ protocol = "ssl" #protocol = "" # +# Set compressed to 1 in case you want to run the tests with +# protocol compression. +# + +compress = 1 +#compress = 0 + +# # Set the host to the host name the test servers are running on. If not # set, the local host is used. # @@ -45,6 +53,11 @@ else: serverProtocol = "" clientServerProtocol = "" +if compress: + clientProtocol += " --Ice.Overwrite.Compress" + serverProtocol += " --Ice.Overwrite.Compress" + clientServerProtocol += " --Ice.Overwrite.Compress" + if host != "": defaultHost = " --Ice.Default.Host=" + host else: diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml index 6ddd50a0692..b6f453fa365 100644 --- a/cpp/doc/Properties.sgml +++ b/cpp/doc/Properties.sgml @@ -304,6 +304,38 @@ router. </section> </section> +<section><title>Ice.Overwrite.Timeout</title> +<section><title>Synopsis</title> +<synopsis> +Ice.Overwrite.Timeout=<replaceable>num</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +If set, this property overwrites timeout settings in all +endpoints. <replaceable>num</replaceable> is the timeout value in +milliseconds, or -1 for no timeout. +</para> +</section> +</section> + +<section><title>Ice.Overwrite.Compression</title> +<section><title>Synopsis</title> +<synopsis> +Ice.Overwrite.Compression=<replaceable>num</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +If set, this property overwrites compession settings in all +proxies. If <replaceable>num</replaceable> is set to a value larger +than zero, compression is enabled. If zero, compression is disabled. +</para> +</section> +</section> + </section> <!-- ********************************************************************** --> diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp index dfafdd59a45..b3aff7f0b2f 100644 --- a/cpp/src/Ice/Connection.cpp +++ b/cpp/src/Ice/Connection.cpp @@ -117,9 +117,16 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway, bool comp) copy(p, p + sizeof(Int), os->b.begin() + headerSize); } - if (_defaultsAndOverwrites->overwriteCompress) + if (os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes. { - comp = _defaultsAndOverwrites->overwriteCompressValue; + comp = false; + } + else + { + if (_defaultsAndOverwrites->overwriteCompress) + { + comp = _defaultsAndOverwrites->overwriteCompressValue; + } } if (comp) @@ -250,9 +257,16 @@ IceInternal::Connection::flushBatchRequest(bool comp) _batchStream.i = _batchStream.b.begin(); - if (_defaultsAndOverwrites->overwriteCompress) + if (_batchStream.b.size() < 100) // Don't compress if message size is smaller than 100 bytes. { - comp = _defaultsAndOverwrites->overwriteCompressValue; + comp = false; + } + else + { + if (_defaultsAndOverwrites->overwriteCompress) + { + comp = _defaultsAndOverwrites->overwriteCompressValue; + } } if (comp) @@ -654,9 +668,16 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa return; } - if (_defaultsAndOverwrites->overwriteCompress) + if (os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes. { - comp = _defaultsAndOverwrites->overwriteCompressValue; + comp = false; + } + else + { + if (_defaultsAndOverwrites->overwriteCompress) + { + comp = _defaultsAndOverwrites->overwriteCompressValue; + } } if (comp) diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h index e6b9f288747..7ab305c5f5b 100644 --- a/cpp/src/Ice/Connection.h +++ b/cpp/src/Ice/Connection.h @@ -22,6 +22,7 @@ #include <Ice/ThreadPoolF.h> #include <Ice/LoggerF.h> #include <Ice/TraceLevelsF.h> +#include <Ice/DefaultsAndOverwritesF.h> #include <Ice/EventHandler.h> namespace Ice @@ -100,6 +101,7 @@ private: ::Ice::ObjectAdapterPtr _adapter; ::Ice::LoggerPtr _logger; TraceLevelsPtr _traceLevels; + DefaultsAndOverwritesPtr _defaultsAndOverwrites; ThreadPoolPtr _clientThreadPool; ThreadPoolPtr _serverThreadPool; ::Ice::Int _nextRequestId; diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 015bed0ebc3..2c8a07ba7a9 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -13,6 +13,7 @@ #include <Ice/Instance.h> #include <Ice/LoggerUtil.h> #include <Ice/TraceLevels.h> +#include <Ice/DefaultsAndOverwrites.h> #include <Ice/Properties.h> #include <Ice/Transceiver.h> #include <Ice/Connector.h> @@ -66,10 +67,17 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi // // Search for existing connections. // + DefaultsAndOverwritesPtr defaultsAndOverwrites = _instance->defaultsAndOverwrites(); vector<EndpointPtr>::const_iterator q; for (q = endpoints.begin(); q != endpoints.end(); ++q) { - map<EndpointPtr, ConnectionPtr>::const_iterator r = _connections.find(*q); + EndpointPtr endpoint = *q; + if (defaultsAndOverwrites->overwriteTimeout) + { + endpoint = endpoint->timeout(defaultsAndOverwrites->overwriteTimeoutValue); + } + + map<EndpointPtr, ConnectionPtr>::const_iterator r = _connections.find(endpoint); if (r != _connections.end()) { return r->second; @@ -87,19 +95,25 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi q = endpoints.begin(); while (q != endpoints.end()) { + EndpointPtr endpoint = *q; + if (defaultsAndOverwrites->overwriteTimeout) + { + endpoint = endpoint->timeout(defaultsAndOverwrites->overwriteTimeoutValue); + } + try { - TransceiverPtr transceiver = (*q)->clientTransceiver(); + TransceiverPtr transceiver = endpoint->clientTransceiver(); if (!transceiver) { - ConnectorPtr connector = (*q)->connector(); + ConnectorPtr connector = endpoint->connector(); assert(connector); - transceiver = connector->connect((*q)->timeout()); + transceiver = connector->connect(endpoint->timeout()); assert(transceiver); } - connection = new Connection(_instance, transceiver, *q, 0); + connection = new Connection(_instance, transceiver, endpoint, 0); connection->activate(); - _connections.insert(make_pair(*q, connection)); + _connections.insert(make_pair(endpoint, connection)); break; } catch (const SocketException& ex) @@ -163,10 +177,17 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router) // ObjectPrx proxy = routerInfo->getClientProxy(); ObjectAdapterPtr adapter = routerInfo->getAdapter(); + DefaultsAndOverwritesPtr defaultsAndOverwrites = _instance->defaultsAndOverwrites(); vector<EndpointPtr>::const_iterator p; for (p = proxy->__reference()->endpoints.begin(); p != proxy->__reference()->endpoints.end(); ++p) { - map<EndpointPtr, ConnectionPtr>::const_iterator q = _connections.find(*p); + EndpointPtr endpoint = *p; + if (defaultsAndOverwrites->overwriteTimeout) + { + endpoint = endpoint->timeout(defaultsAndOverwrites->overwriteTimeoutValue); + } + + map<EndpointPtr, ConnectionPtr>::const_iterator q = _connections.find(endpoint); if (q != _connections.end()) { q->second->setAdapter(adapter); @@ -409,6 +430,12 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance _adapter(adapter), _state(StateHolding) { + DefaultsAndOverwritesPtr defaultsAndOverwrites = _instance->defaultsAndOverwrites(); + if (defaultsAndOverwrites->overwriteTimeout) + { + _endpoint = _endpoint->timeout(defaultsAndOverwrites->overwriteTimeoutValue); + } + _warn = _instance->properties()->getPropertyAsInt("Ice.ConnectionWarnings") > 0; try |