summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ConnectionI.cpp18
-rw-r--r--cpp/src/Ice/Instance.cpp52
-rw-r--r--cpp/src/Ice/Instance.h6
-rw-r--r--cpp/src/Ice/PropertyNames.cpp4
-rw-r--r--cpp/src/Ice/PropertyNames.h2
5 files changed, 68 insertions, 14 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 101cf69e693..34047945c65 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -1378,7 +1378,6 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
_traceLevels(_instance->traceLevels()), // Cached for better performance.
_registeredWithPool(false),
_warn(_instance->properties()->getPropertyAsInt("Ice.Warn.Connections") > 0),
- _acmTimeout(_endpoint->datagram() ? 0 : _instance->connectionIdleTime()),
_requestHdr(headerSize + sizeof(Int), 0),
_requestBatchHdr(headerSize + sizeof(Int), 0),
_replyHdr(headerSize, 0),
@@ -1393,6 +1392,23 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
_state(StateNotValidated),
_stateTime(IceUtil::Time::now())
{
+ Int& acmTimeout = const_cast<Int&>(_acmTimeout);
+ if(_endpoint->datagram())
+ {
+ acmTimeout = 0;
+ }
+ else
+ {
+ if(_adapter)
+ {
+ acmTimeout = _instance->serverConnectionIdleTime();
+ }
+ else
+ {
+ acmTimeout = _instance->clientConnectionIdleTime();
+ }
+ }
+
vector<Byte>& requestHdr = const_cast<vector<Byte>&>(_requestHdr);
requestHdr[0] = magic[0];
requestHdr[1] = magic[1];
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 917691beb51..a3a37bac58f 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -342,10 +342,17 @@ IceInternal::Instance::messageSizeMax() const
}
int
-IceInternal::Instance::connectionIdleTime() const
+IceInternal::Instance::clientConnectionIdleTime() const
{
// No mutex lock, immutable.
- return _connectionIdleTime;
+ return _clientConnectionIdleTime;
+}
+
+int
+IceInternal::Instance::serverConnectionIdleTime() const
+{
+ // No mutex lock, immutable.
+ return _serverConnectionIdleTime;
}
void
@@ -387,7 +394,8 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
_destroyed(false),
_properties(properties),
_messageSizeMax(0),
- _connectionIdleTime(0),
+ _clientConnectionIdleTime(0),
+ _serverConnectionIdleTime(0),
_threadPerConnection(false),
_threadPerConnectionStackSize(0)
{
@@ -550,14 +558,27 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
}
{
- Int num = _properties->getPropertyAsIntWithDefault("Ice.ConnectionIdleTime", 60);
- if(num < 0)
+ Int num = _properties->getPropertyAsInt("Ice.ConnectionIdleTime");
+ if(num > 0)
{
- const_cast<Int&>(_connectionIdleTime) = 0;
+ const_cast<Int&>(_clientConnectionIdleTime) = num;
+ const_cast<Int&>(_serverConnectionIdleTime) = num;
}
- else
+ }
+
+ {
+ Int num = _properties->getPropertyAsIntWithDefault("Ice.ConnectionIdleTime.Client", 60);
+ if(num > 0)
+ {
+ const_cast<Int&>(_clientConnectionIdleTime) = num;
+ }
+ }
+
+ {
+ Int num = _properties->getPropertyAsInt("Ice.ConnectionIdleTime.Server");
+ if(num > 0)
{
- const_cast<Int&>(_connectionIdleTime) = num;
+ const_cast<Int&>(_serverConnectionIdleTime) = num;
}
}
@@ -707,7 +728,20 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
//
// Start connection monitor if necessary.
//
- Int interval = _properties->getPropertyAsIntWithDefault("Ice.MonitorConnections", _connectionIdleTime);
+ Int interval = 0;
+ if(_clientConnectionIdleTime > 0 && _serverConnectionIdleTime > 0)
+ {
+ interval = min(_clientConnectionIdleTime, _serverConnectionIdleTime);
+ }
+ else if(_clientConnectionIdleTime > 0)
+ {
+ interval = _clientConnectionIdleTime;
+ }
+ else if(_serverConnectionIdleTime > 0)
+ {
+ interval = _serverConnectionIdleTime;
+ }
+ interval = _properties->getPropertyAsIntWithDefault("Ice.MonitorConnections", interval);
if(interval > 0)
{
_connectionMonitor = new ConnectionMonitor(this, interval);
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index 7eeb64590b2..bfef7283dc9 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -71,7 +71,8 @@ public:
DynamicLibraryListPtr dynamicLibraryList() const;
Ice::PluginManagerPtr pluginManager() const;
size_t messageSizeMax() const;
- Ice::Int connectionIdleTime() const;
+ Ice::Int clientConnectionIdleTime() const;
+ Ice::Int serverConnectionIdleTime() const;
void flushBatchRequests();
void setDefaultContext(const ::Ice::Context&);
const ::Ice::Context& getDefaultContext() const;
@@ -91,7 +92,8 @@ private:
const TraceLevelsPtr _traceLevels; // Immutable, not reset by destroy().
const DefaultsAndOverridesPtr _defaultsAndOverrides; // Immutable, not reset by destroy().
const size_t _messageSizeMax; // Immutable, not reset by destroy().
- const Ice::Int _connectionIdleTime; // Immutable, not reset by destroy().
+ const Ice::Int _clientConnectionIdleTime; // Immutable, not reset by destroy().
+ const Ice::Int _serverConnectionIdleTime; // Immutable, not reset by destroy().
RouterManagerPtr _routerManager;
LocatorManagerPtr _locatorManager;
ReferenceFactoryPtr _referenceFactory;
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 00fb00fa3d6..6b302897326 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Apr 4 15:50:49 2005
+// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Apr 6 18:27:30 2005
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -18,6 +18,8 @@ const char* IceInternal::PropertyNames::IceProps[] =
"Ice.ChangeUser",
"Ice.Config",
"Ice.ConnectionIdleTime",
+ "Ice.ConnectionIdleTime.Client",
+ "Ice.ConnectionIdleTime.Server",
"Ice.Default.Host",
"Ice.Default.Locator",
"Ice.Default.Package",
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 12494077d26..127dc85a7be 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Apr 4 15:50:49 2005
+// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Apr 6 18:27:30 2005
// IMPORTANT: Do not edit this file -- any edits made here will be lost!