diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-08-08 13:33:18 -0230 |
commit | c540f34ba2dd245e88cee99f39552efbd44c91e1 (patch) | |
tree | a637ce6dce7ad189069e784f21d5166c6a98aff1 /cpp | |
parent | Fixed (ICE-5583) - Consider adding IceSSL.CertAuthFile to C# implementation (diff) | |
download | ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.bz2 ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.tar.xz ice-c540f34ba2dd245e88cee99f39552efbd44c91e1.zip |
ICE-5596 add Ice.Default.Timeout property
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/DefaultsAndOverrides.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/DefaultsAndOverrides.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/IPEndpointI.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 1 | ||||
-rw-r--r-- | cpp/src/Ice/ProtocolInstance.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/ProtocolInstance.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/TcpEndpointI.cpp | 37 | ||||
-rw-r--r-- | cpp/src/Ice/TcpEndpointI.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/winrt/StreamEndpointI.cpp | 37 | ||||
-rw-r--r-- | cpp/src/Ice/winrt/StreamEndpointI.h | 1 | ||||
-rw-r--r-- | cpp/src/IceSSL/EndpointI.cpp | 37 | ||||
-rw-r--r-- | cpp/src/IceSSL/EndpointI.h | 1 | ||||
-rwxr-xr-x | cpp/test/Glacier2/staticFiltering/run.py | 4 | ||||
-rw-r--r-- | cpp/test/Ice/metrics/AllTests.cpp | 74 | ||||
-rw-r--r-- | cpp/test/Ice/proxy/AllTests.cpp | 24 |
15 files changed, 165 insertions, 72 deletions
diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp index 8df552d9d20..fc4cf920a7f 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.cpp +++ b/cpp/src/Ice/DefaultsAndOverrides.cpp @@ -110,6 +110,15 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro throw ex; } + const_cast<int&>(defaultTimeout) = + properties->getPropertyAsIntWithDefault("Ice.Default.Timeout", 60000); + if(defaultTimeout < 1 && defaultTimeout != -1) + { + InitializationException ex(__FILE__, __LINE__); + ex.reason = "invalid value for Ice.Default.Timeout: `" + properties->getProperty("Ice.Default.Timeout") + "'"; + throw ex; + } + const_cast<int&>(defaultInvocationTimeout) = properties->getPropertyAsIntWithDefault("Ice.Default.InvocationTimeout", -1); diff --git a/cpp/src/Ice/DefaultsAndOverrides.h b/cpp/src/Ice/DefaultsAndOverrides.h index 5ce55469c31..01d6ec345c7 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.h +++ b/cpp/src/Ice/DefaultsAndOverrides.h @@ -33,6 +33,7 @@ public: std::string defaultProtocol; bool defaultCollocationOptimization; Ice::EndpointSelectionType defaultEndpointSelection; + int defaultTimeout; int defaultInvocationTimeout; int defaultLocatorCacheTimeout; bool defaultPreferSecure; diff --git a/cpp/src/Ice/IPEndpointI.h b/cpp/src/Ice/IPEndpointI.h index 06cb405e5da..f63a137f3b3 100644 --- a/cpp/src/Ice/IPEndpointI.h +++ b/cpp/src/Ice/IPEndpointI.h @@ -76,7 +76,7 @@ public: using EndpointI::connectors; using EndpointI::connectionId; - void initWithOptions(std::vector<std::string>&, bool); + virtual void initWithOptions(std::vector<std::string>&, bool); protected: diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 44c32e9e96b..78e3ce143ec 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -106,6 +106,7 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Default.Router", false, 0), IceInternal::Property("Ice.Default.SlicedFormat", false, 0), IceInternal::Property("Ice.Default.SourceAddress", false, 0), + IceInternal::Property("Ice.Default.Timeout", false, 0), IceInternal::Property("Ice.IPv4", false, 0), IceInternal::Property("Ice.IPv6", false, 0), IceInternal::Property("Ice.EventLog.Source", false, 0), diff --git a/cpp/src/Ice/ProtocolInstance.cpp b/cpp/src/Ice/ProtocolInstance.cpp index b643a0c7020..363de0cb1b0 100644 --- a/cpp/src/Ice/ProtocolInstance.cpp +++ b/cpp/src/Ice/ProtocolInstance.cpp @@ -72,6 +72,13 @@ IceInternal::ProtocolInstance::defaultEncoding() const return _instance->defaultsAndOverrides()->defaultEncoding; } +int +IceInternal::ProtocolInstance::defaultTimeout() const +{ + return _instance->defaultsAndOverrides()->defaultTimeout; +} + + NetworkProxyPtr IceInternal::ProtocolInstance::networkProxy() const { diff --git a/cpp/src/Ice/ProtocolInstance.h b/cpp/src/Ice/ProtocolInstance.h index 6a356af9a87..9a0ebec59b9 100644 --- a/cpp/src/Ice/ProtocolInstance.h +++ b/cpp/src/Ice/ProtocolInstance.h @@ -65,6 +65,7 @@ public: const Ice::EncodingVersion& defaultEncoding() const; NetworkProxyPtr networkProxy() const; size_t messageSizeMax() const; + int defaultTimeout() const; std::vector<ConnectorPtr> resolve(const std::string&, int, Ice::EndpointSelectionType, const IPEndpointIPtr&) const; void resolve(const std::string&, int, Ice::EndpointSelectionType, const IPEndpointIPtr&, diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 7d593d6203a..a47c956c6c2 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -32,7 +32,7 @@ IceInternal::TcpEndpointI::TcpEndpointI(const ProtocolInstancePtr& instance, con IceInternal::TcpEndpointI::TcpEndpointI(const ProtocolInstancePtr& instance) : IPEndpointI(instance), - _timeout(-1), + _timeout(-2), _compress(false) { } @@ -164,7 +164,11 @@ IceInternal::TcpEndpointI::options() const s << IPEndpointI::options(); - if(_timeout != -1) + if(_timeout == -1) + { + s << " -t infinite"; + } + else { s << " -t " << _timeout; } @@ -277,6 +281,17 @@ IceInternal::TcpEndpointI::fillEndpointInfo(IPEndpointInfo* info) const } } +void +IceInternal::TcpEndpointI::initWithOptions(vector<string>& args, bool oaEndpoint) +{ + IPEndpointI::initWithOptions(args, oaEndpoint); + + if(_timeout == -2) + { + const_cast<Int&>(_timeout) = _instance->defaultTimeout(); + } +} + bool IceInternal::TcpEndpointI::checkOption(const string& option, const string& argument, const string& endpoint) { @@ -295,12 +310,20 @@ IceInternal::TcpEndpointI::checkOption(const string& option, const string& argum ex.str = "no argument provided for -t option in endpoint " + endpoint; throw ex; } - istringstream t(argument); - if(!(t >> const_cast<Int&>(_timeout)) || !t.eof()) + + if(argument == "infinite") + { + const_cast<Int&>(_timeout) = -1; + } + else { - EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; - throw ex; + istringstream t(argument); + if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; + throw ex; + } } return true; } diff --git a/cpp/src/Ice/TcpEndpointI.h b/cpp/src/Ice/TcpEndpointI.h index 3dba15da6f4..0e94a1d1de7 100644 --- a/cpp/src/Ice/TcpEndpointI.h +++ b/cpp/src/Ice/TcpEndpointI.h @@ -50,6 +50,7 @@ protected: virtual void streamWriteImpl(BasicStream*) const; virtual void hashInit(Ice::Int&) const; virtual void fillEndpointInfo(Ice::IPEndpointInfo*) const; + virtual void initWithOptions(std::vector<std::string>&, bool); virtual bool checkOption(const std::string&, const std::string&, const std::string&); virtual ConnectorPtr createConnector(const Address&, const NetworkProxyPtr&) const; diff --git a/cpp/src/Ice/winrt/StreamEndpointI.cpp b/cpp/src/Ice/winrt/StreamEndpointI.cpp index b58f9e826ce..5bb59dea33b 100644 --- a/cpp/src/Ice/winrt/StreamEndpointI.cpp +++ b/cpp/src/Ice/winrt/StreamEndpointI.cpp @@ -72,7 +72,7 @@ IceInternal::StreamEndpointI::StreamEndpointI(const ProtocolInstancePtr& instanc IceInternal::StreamEndpointI::StreamEndpointI(const ProtocolInstancePtr& instance) : IPEndpointI(instance), - _timeout(-1), + _timeout(-2), _compress(false) { } @@ -193,7 +193,11 @@ IceInternal::StreamEndpointI::options() const s << IPEndpointI::options(); - if(_timeout != -1) + if(_timeout == -1) + { + s << " -t infinite"; + } + else { s << " -t " << _timeout; } @@ -294,6 +298,17 @@ IceInternal::StreamEndpointI::hashInit(Ice::Int& h) const hashAdd(h, _compress); } +void +IceInternal::StreamEndpointI::initWithOptions(vector<string>& args, bool oaEndpoint) +{ + IPEndpointI::initWithOptions(args, oaEndpoint); + + if(_timeout == -2) + { + const_cast<Int&>(_timeout) = _instance->defaultTimeout(); + } +} + bool IceInternal::StreamEndpointI::checkOption(const string& option, const string& argument, const string& endpoint) { @@ -312,12 +327,20 @@ IceInternal::StreamEndpointI::checkOption(const string& option, const string& ar ex.str = "no argument provided for -t option in endpoint " + endpoint; throw ex; } - istringstream t(argument); - if(!(t >> const_cast<Int&>(_timeout)) || !t.eof()) + + if(argument == "infinite") { - EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; - throw ex; + const_cast<Int&>(_timeout) = -1; + } + else + { + istringstream t(argument); + if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; + throw ex; + } } return true; } diff --git a/cpp/src/Ice/winrt/StreamEndpointI.h b/cpp/src/Ice/winrt/StreamEndpointI.h index 59ebc442417..58de59fd410 100644 --- a/cpp/src/Ice/winrt/StreamEndpointI.h +++ b/cpp/src/Ice/winrt/StreamEndpointI.h @@ -49,6 +49,7 @@ protected: virtual void streamWriteImpl(BasicStream*) const; virtual void hashInit(Ice::Int&) const; + virtual void initWithOptions(std::vector<std::string>&, bool); virtual bool checkOption(const std::string&, const std::string&, const std::string&); virtual ConnectorPtr createConnector(const Address&, const NetworkProxyPtr&) const; diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index 7782e11f517..aab9bb2efc6 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -33,7 +33,7 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int IceSSL::EndpointI::EndpointI(const InstancePtr& instance) : IceInternal::IPEndpointI(instance), _instance(instance), - _timeout(-1), + _timeout(-2), _compress(false) { } @@ -165,7 +165,11 @@ IceSSL::EndpointI::options() const ostringstream s; s << IPEndpointI::options(); - if(_timeout != -1) + if(_timeout == -1) + { + s << " -t infinite"; + } + else { s << " -t " << _timeout; } @@ -278,6 +282,17 @@ IceSSL::EndpointI::fillEndpointInfo(IPEndpointInfo* info) const } } +void +IceSSL::EndpointI::initWithOptions(vector<string>& args, bool oaEndpoint) +{ + IPEndpointI::initWithOptions(args, oaEndpoint); + + if(_timeout == -2) + { + const_cast<Int&>(_timeout) = _instance->defaultTimeout(); + } +} + bool IceSSL::EndpointI::checkOption(const string& option, const string& argument, const string& endpoint) { @@ -296,12 +311,20 @@ IceSSL::EndpointI::checkOption(const string& option, const string& argument, con ex.str = "no argument provided for -t option in endpoint " + endpoint; throw ex; } - istringstream t(argument); - if(!(t >> const_cast<Int&>(_timeout)) || !t.eof()) + + if(argument == "infinite") + { + const_cast<Int&>(_timeout) = -1; + } + else { - EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; - throw ex; + istringstream t(argument); + if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint; + throw ex; + } } return true; } diff --git a/cpp/src/IceSSL/EndpointI.h b/cpp/src/IceSSL/EndpointI.h index 5d797d2dfe7..a760e8d3ae8 100644 --- a/cpp/src/IceSSL/EndpointI.h +++ b/cpp/src/IceSSL/EndpointI.h @@ -51,6 +51,7 @@ protected: virtual void streamWriteImpl(IceInternal::BasicStream*) const; virtual void hashInit(Ice::Int&) const; virtual void fillEndpointInfo(Ice::IPEndpointInfo*) const; + virtual void initWithOptions(std::vector<std::string>&, bool); virtual bool checkOption(const std::string&, const std::string&, const std::string&); virtual IceInternal::ConnectorPtr createConnector(const IceInternal::Address&, diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index d77870462aa..f1b459a7863 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -218,8 +218,8 @@ if not limitedTests: [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn), (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), ('testing maximum proxy length rule', - ('', '', '41', '', '', ''), - [(True, 'hello:tcp -h 127.0.0.1 -p 12010'), + ('', '', '53', '', '', ''), + [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'), (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []), ]) diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index cf9904e8dc8..7fb13af91e1 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -56,7 +56,7 @@ private: typedef IceUtil::Handle<Callback> CallbackPtr; Ice::PropertyDict -getClientProps(const Ice::PropertiesAdminPrx& p, const Ice::PropertyDict& orig, const string& m = string()) +getClientProps(const Ice::PropertiesAdminPrx& p, const Ice::PropertyDict& orig, const string& m = string()) { Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics"); for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p) @@ -137,7 +137,7 @@ public: } if(_serverProps->ice_getConnection()) { - // Ensure that the previous updates were committed, the setProperties call returns before + // Ensure that the previous updates were committed, the setProperties call returns before // notifying the callbacks so to ensure all the update callbacks have be notified we call // a second time, this will block until all the notifications from the first update have // completed. @@ -186,10 +186,10 @@ waitForCurrent(const IceMX::MetricsAdminPrx& metrics, const string& viewName, co } template<typename T> void -testAttribute(const IceMX::MetricsAdminPrx& metrics, - const Ice::PropertiesAdminPrx& props, +testAttribute(const IceMX::MetricsAdminPrx& metrics, + const Ice::PropertiesAdminPrx& props, UpdateCallbackI* update, - const string& map, + const string& map, const string& attr, const string& value, const T& func) @@ -239,7 +239,7 @@ testAttribute(const IceMX::MetricsAdminPrx& metrics, struct Void { - void + void operator()() const { } @@ -293,10 +293,10 @@ struct InvokeOp }; void -testAttribute(const IceMX::MetricsAdminPrx& metrics, - const Ice::PropertiesAdminPrx& props, +testAttribute(const IceMX::MetricsAdminPrx& metrics, + const Ice::PropertiesAdminPrx& props, UpdateCallbackI* update, - const string& map, + const string& map, const string& attr, const string& value) { @@ -304,9 +304,9 @@ testAttribute(const IceMX::MetricsAdminPrx& metrics, } void -updateProps(const Ice::PropertiesAdminPrx& cprops, - const Ice::PropertiesAdminPrx& sprops, - UpdateCallbackI* callback, +updateProps(const Ice::PropertiesAdminPrx& cprops, + const Ice::PropertiesAdminPrx& sprops, + UpdateCallbackI* callback, const Ice::PropertyDict& props, const string& map = string()) { @@ -410,7 +410,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt props["IceMX.Metrics.View.GroupBy"] = "none"; updateProps(clientProps, serverProps, update, props); - + #ifndef ICE_OS_WINRT int threadCount = 3; #else @@ -421,10 +421,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt IceMX::MetricsView view = clientMetrics->getMetricsView("View", timestamp); if(!collocated) { - test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && + test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && view["Connection"][0]->total == 1); } - test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount && + test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount && view["Thread"][0]->total == threadCount); cout << "ok" << endl; @@ -476,13 +476,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt { metrics->ice_getConnection()->close(false); metrics->ice_connectionId("Con1")->ice_getConnection()->close(false); - + waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); } clearView(clientProps, serverProps, update); - + cout << "ok" << endl; map<string, IceMX::MetricsPtr> map; @@ -555,7 +555,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt test(cm2->receivedBytes - cm1->receivedBytes == replySz); test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4); test(sm2->sentBytes - sm1->sentBytes == replySz); - + props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state"; updateProps(clientProps, serverProps, update, props, "Connection"); @@ -643,7 +643,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010"); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", ""); - + m->ice_getConnection()->close(false); waitForCurrent(clientMetrics, "View", "Connection", 0); @@ -658,7 +658,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].empty()); metrics->ice_ping(); - + test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1); IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0]; test(m1->current == 0 && m1->total == 1 && m1->id == "127.0.0.1:12010"); @@ -687,13 +687,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt Connect c(metrics); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", - "tcp -h 127.0.0.1 -p 12010", c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", + "tcp -h 127.0.0.1 -p 12010 -t 60000", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "60000", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c); @@ -711,13 +711,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt updateProps(clientProps, serverProps, update, props, "EndpointLookup"); test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty()); - Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost"); + Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); prx->ice_ping(); - + test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0]; - test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010"); + test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010 -t infinite"); prx->ice_getConnection()->close(false); @@ -737,7 +737,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt } test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1]; - test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 && + test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 && (!dnsException || m1->failures == 2)); if(dnsException) { @@ -747,9 +747,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt c = Connect(prx); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", - "tcp -h localhost -p 12010", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", + "tcp -h localhost -p 12010 -t infinite", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", + "tcp -h localhost -p 12010 -t infinite", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c); @@ -853,13 +854,14 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op); if(!collocated) { - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010 -t 60000", + op); //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op); - + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op); @@ -1017,7 +1019,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]); test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0); test(rim1->size == 63 && rim1->replySize == 21); - + im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithUserException"]); test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0); test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1)); @@ -1071,8 +1073,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update, "Invocation", "facet", "", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "encoding", "1.1", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "mode", "twoway", op); - testAttribute(clientMetrics, clientProps, update, "Invocation", "proxy", - "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010", op); + testAttribute(clientMetrics, clientProps, update, "Invocation", "proxy", + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 60000", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry1", "test", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry2", "", op); diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index ccf635bb3c6..34754f816b7 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -531,7 +531,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!(compObj->ice_locator(loc1) < compObj->ice_locator(0))); test(compObj->ice_locator(loc1) < compObj->ice_locator(loc2)); test(!(compObj->ice_locator(loc2) < compObj->ice_locator(loc1))); - + Ice::RouterPrx rtr1 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr1:default -p 10000")); Ice::RouterPrx rtr2 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr2:default -p 10000")); test(compObj->ice_router(0) == compObj->ice_router(0)); @@ -543,7 +543,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!(compObj->ice_router(rtr1) < compObj->ice_router(0))); test(compObj->ice_router(rtr1) < compObj->ice_router(rtr2)); test(!(compObj->ice_router(rtr2) < compObj->ice_router(rtr1))); - + Ice::Context ctx1; ctx1["ctx1"] = "v1"; Ice::Context ctx2; @@ -555,12 +555,12 @@ allTests(const Ice::CommunicatorPtr& communicator) test(compObj->ice_context(ctx1) != compObj->ice_context(ctx2)); test(compObj->ice_context(ctx1) < compObj->ice_context(ctx2)); test(!(compObj->ice_context(ctx2) < compObj->ice_context(ctx1))); - + test(compObj->ice_preferSecure(true) == compObj->ice_preferSecure(true)); test(compObj->ice_preferSecure(true) != compObj->ice_preferSecure(false)); test(compObj->ice_preferSecure(false) < compObj->ice_preferSecure(true)); test(!(compObj->ice_preferSecure(true) < compObj->ice_preferSecure(false))); - + Ice::ObjectPrx compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); Ice::ObjectPrx compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); test(compObj1 != compObj2); @@ -610,13 +610,13 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing checked cast... " << flush; Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); - + Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); test(derived); test(cl == base); test(derived == base); test(cl == derived); - + Ice::LocatorPrx loc = Ice::LocatorPrx::checkedCast(base); test(loc == 0); @@ -640,7 +640,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(cl == base); test(derived == base); test(cl == derived); - + loc = checkedCast<Ice::LocatorPrx>(base); test(loc == 0); @@ -679,7 +679,7 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing encoding versioning... " << flush; string ref20 = "test -e 2.0:default -p 12010"; Test::MyClassPrx cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); - try + try { cl20->ice_collocationOptimized(false)->ice_ping(); test(false); @@ -701,7 +701,7 @@ allTests(const Ice::CommunicatorPtr& communicator) Test::MyClassPrx cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); cl13->ice_ping(); cl13->end_ice_ping(cl13->begin_ice_ping()); - + try { // Send request with bogus 1.2 encoding. @@ -750,7 +750,7 @@ allTests(const Ice::CommunicatorPtr& communicator) ref20 = "test -p 2.0:default -p 12010"; cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); - try + try { cl20->ice_collocationOptimized(false)->ice_ping(); test(false); @@ -922,7 +922,7 @@ allTests(const Ice::CommunicatorPtr& communicator) pstr = communicator->proxyToString(p1); if(ssl) { - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch"); + test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { @@ -957,7 +957,7 @@ allTests(const Ice::CommunicatorPtr& communicator) pstr = communicator->proxyToString(p2); if(ssl) { - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch"); + test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { |