summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/config/TestUtil.py13
-rw-r--r--cpp/doc/Properties.sgml32
-rw-r--r--cpp/src/Ice/Connection.cpp33
-rw-r--r--cpp/src/Ice/Connection.h2
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp41
-rw-r--r--java/src/IceInternal/IncomingConnectionFactory.java5
-rw-r--r--java/src/IceInternal/OutgoingConnectionFactory.java37
7 files changed, 141 insertions, 22 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
diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java
index 909c5c3cad2..f5a44a5c7db 100644
--- a/java/src/IceInternal/IncomingConnectionFactory.java
+++ b/java/src/IceInternal/IncomingConnectionFactory.java
@@ -201,6 +201,11 @@ public class IncomingConnectionFactory extends EventHandler
{
super(instance);
_endpoint = endpoint;
+ DefaultsAndOverwrites defaultsAndOverwrites = _instance.defaultsAndOverwrites();
+ if (defaultsAndOverwrites.overwriteTimeout)
+ {
+ _endpoint = _endpoint.timeout(defaultsAndOverwrites.overwriteTimeoutValue);
+ }
_adapter = adapter;
_state = StateHolding;
_warn = _instance.properties().getPropertyAsInt("Ice.ConnectionWarnings") > 0 ? true : false;
diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java
index a6651a490ce..5a36de0e9da 100644
--- a/java/src/IceInternal/OutgoingConnectionFactory.java
+++ b/java/src/IceInternal/OutgoingConnectionFactory.java
@@ -38,9 +38,16 @@ public class OutgoingConnectionFactory
//
// Search for existing connections.
//
+ DefaultsAndOverwrites defaultsAndOverwrites = _instance.defaultsAndOverwrites();
for (int i = 0; i < endpoints.length; i++)
{
- Connection connection = (Connection)_connections.get(endpoints[i]);
+ Endpoint endpoint = endpoints[i];
+ if (defaultsAndOverwrites.overwriteTimeout)
+ {
+ endpoint = endpoint.timeout(defaultsAndOverwrites.overwriteTimeoutValue);
+ }
+
+ Connection connection = (Connection)_connections.get(endpoints);
if (connection != null)
{
return connection;
@@ -57,19 +64,25 @@ public class OutgoingConnectionFactory
Ice.LocalException exception = null;
for (int i = 0; i < endpoints.length; i++)
{
- try
+ Endpoint endpoint = endpoints[i];
+ if (defaultsAndOverwrites.overwriteTimeout)
+ {
+ endpoint = endpoint.timeout(defaultsAndOverwrites.overwriteTimeoutValue);
+ }
+
+ try
{
- Transceiver transceiver = endpoints[i].clientTransceiver();
+ Transceiver transceiver = endpoint.clientTransceiver();
if (transceiver == null)
{
- Connector connector = endpoints[i].connector();
+ Connector connector = endpoint.connector();
assert(connector != null);
- transceiver = connector.connect(endpoints[i].timeout());
+ transceiver = connector.connect(endpoint.timeout());
assert(transceiver != null);
}
- connection = new Connection(_instance, transceiver, endpoints[i], null);
+ connection = new Connection(_instance, transceiver, endpoint, null);
connection.activate();
- _connections.put(endpoints[i], connection);
+ _connections.put(endpoint, connection);
break;
}
catch (Ice.SocketException ex)
@@ -136,11 +149,17 @@ public class OutgoingConnectionFactory
//
Ice.ObjectPrx proxy = routerInfo.getClientProxy();
Ice.ObjectAdapter adapter = routerInfo.getAdapter();
+ DefaultsAndOverwrites defaultsAndOverwrites = _instance.defaultsAndOverwrites();
Endpoint[] endpoints = ((Ice.ObjectPrxHelper)proxy).__reference().endpoints;
for (int i = 0; i < endpoints.length; i++)
{
- Connection connection =
- (Connection)_connections.get(endpoints[i]);
+ Endpoint endpoint = endpoints[i];
+ if (defaultsAndOverwrites.overwriteTimeout)
+ {
+ endpoint = endpoint.timeout(defaultsAndOverwrites.overwriteTimeoutValue);
+ }
+
+ Connection connection = (Connection)_connections.get(endpoint);
if (connection != null)
{
connection.setAdapter(adapter);