diff options
100 files changed, 1185 insertions, 1859 deletions
diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml index 6fb1a08f8e5..b2a7b941036 100644 --- a/config/PropertyNames.xml +++ b/config/PropertyNames.xml @@ -249,7 +249,6 @@ generated from the section label. <suffix name="LocatorCacheTimeout" /> <suffix name="Locator" /> <suffix name="Router" /> - <suffix name="EncodingVersion" /> <suffix name="CollocationOptimized" /> </class> diff --git a/cpp/config/Make.rules.MINGW b/cpp/config/Make.rules.MINGW index 29d9c3dba4e..63d2a6a524f 100644 --- a/cpp/config/Make.rules.MINGW +++ b/cpp/config/Make.rules.MINGW @@ -29,7 +29,6 @@ ifeq ($(OPTIMIZE),yes) CXXFLAGS += -O2 -DNDEBUG else CXXFLAGS += -g -D_DEBUG - LIBSUFFIX = d endif COMPSUFFIX = mingw_ diff --git a/cpp/src/Ice/EndpointI.cpp b/cpp/src/Ice/EndpointI.cpp index e9762fe2eec..0115a5f31cc 100644 --- a/cpp/src/Ice/EndpointI.cpp +++ b/cpp/src/Ice/EndpointI.cpp @@ -46,18 +46,6 @@ Init init; Ice::LocalObject* IceInternal::upCast(EndpointI* p) { return p; } IceUtil::Shared* IceInternal::upCast(EndpointHostResolver* p) { return p; } -const Ice::EncodingVersion& -IceInternal::EndpointI::encodingVersion() const -{ - return _encoding; -} - -const Ice::ProtocolVersion& -IceInternal::EndpointI::protocolVersion() const -{ - return _protocol; -} - const string& IceInternal::EndpointI::connectionId() const { @@ -86,74 +74,17 @@ IceInternal::EndpointI::connectors(const vector<Address>& addrs) const return vector<ConnectorPtr>(); } -IceInternal::EndpointI::EndpointI(const Ice::ProtocolVersion& protocol, - const Ice::EncodingVersion& encoding, - const std::string& connectionId) : - _protocol(protocol), - _encoding(encoding), +IceInternal::EndpointI::EndpointI(const std::string& connectionId) : _connectionId(connectionId), _hashInitialized(false) { } IceInternal::EndpointI::EndpointI() : - _protocol(Ice::currentProtocol), - _encoding(Ice::currentEncoding), _hashInitialized(false) { } -void -IceInternal::EndpointI::parseOption(const string& option, const string& arg, const string& desc, const string& str) -{ - if(option == "-v") - { - if(arg.empty()) - { - Ice::EndpointParseException ex(__FILE__, __LINE__); - ex.str = "no argument provided for -v option in endpoint `" + desc + " " + str + "'"; - throw ex; - } - - try - { - const_cast<Ice::ProtocolVersion&>(_protocol) = Ice::stringToProtocolVersion(arg); - } - catch(const Ice::VersionParseException& e) - { - Ice::EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid protocol version `" + arg + "' in endpoint `" + desc + " " + str + "':\n" + e.str; - throw ex; - } - } - else if(option == "-e") - { - if(arg.empty()) - { - Ice::EndpointParseException ex(__FILE__, __LINE__); - ex.str = "no argument provided for -e option in endpoint `" + desc + " " + str + "'"; - throw ex; - } - - try - { - const_cast<Ice::EncodingVersion&>(_encoding) = Ice::stringToEncodingVersion(arg); - } - catch(const Ice::VersionParseException& e) - { - Ice::EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid encoding version `" + arg + "' in endpoint `" + desc + " " + str + "':\n" + e.str; - throw ex; - } - } - else - { - Ice::EndpointParseException ex(__FILE__, __LINE__); - ex.str = "unknown option `" + option + "' in `" + desc + " " + str + "'"; - throw ex; - } -} - #ifndef ICE_OS_WINRT IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance) : diff --git a/cpp/src/Ice/EndpointI.h b/cpp/src/Ice/EndpointI.h index 17f079d1c1e..e7e1a208f19 100644 --- a/cpp/src/Ice/EndpointI.h +++ b/cpp/src/Ice/EndpointI.h @@ -105,16 +105,6 @@ public: virtual bool secure() const = 0; // - // Returns the encoding version supported by this endpoint. - // - const ::Ice::EncodingVersion& encodingVersion() const; - - // - // Returns the encoding version supported by this endpoint. - // - const ::Ice::ProtocolVersion& protocolVersion() const; - - // // Return a server side transceiver for this endpoint, or null if a // transceiver can only be created by an acceptor. In case a // transceiver is created, this operation also returns a new @@ -165,15 +155,11 @@ protected: virtual std::vector<ConnectorPtr> connectors(const std::vector<Address>&) const; friend class EndpointHostResolver; - EndpointI(const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::string&); + EndpointI(const std::string&); EndpointI(); - void parseOption(const std::string&, const std::string&, const std::string&, const std::string&); - virtual ::Ice::Int hashInit() const = 0; - const Ice::ProtocolVersion _protocol; - const Ice::EncodingVersion _encoding; const std::string _connectionId; private: diff --git a/cpp/src/Ice/InstrumentationI.h b/cpp/src/Ice/InstrumentationI.h index d8f9641c76c..035aed387cc 100644 --- a/cpp/src/Ice/InstrumentationI.h +++ b/cpp/src/Ice/InstrumentationI.h @@ -24,8 +24,6 @@ void addEndpointAttributes(typename Helper::Attributes& attrs) attrs.add("endpointType", &Helper::getEndpointInfo, &Ice::EndpointInfo::type); attrs.add("endpointIsDatagram", &Helper::getEndpointInfo, &Ice::EndpointInfo::datagram); attrs.add("endpointIsSecure", &Helper::getEndpointInfo, &Ice::EndpointInfo::secure); - attrs.add("endpointProtocolVersion", &Helper::getEndpointInfo, &Ice::EndpointInfo::protocol); - attrs.add("endpointEncodingVersion", &Helper::getEndpointInfo, &Ice::EndpointInfo::encoding); attrs.add("endpointTimeout", &Helper::getEndpointInfo, &Ice::EndpointInfo::timeout); attrs.add("endpointCompress", &Helper::getEndpointInfo, &Ice::EndpointInfo::compress); diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index ac693041b2e..0acf9db3f90 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -156,16 +156,17 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc) // have only one table per locator (not one per locator // proxy). // - map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity()); + pair<Identity, EncodingVersion> locatorKey(locator->ice_getIdentity(), locator->ice_getEncodingVersion()); + map<pair<Identity, EncodingVersion>, LocatorTablePtr>::iterator t = _locatorTables.find(locatorKey); if(t == _locatorTables.end()) { t = _locatorTables.insert(_locatorTables.begin(), - pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(), - new LocatorTable())); + pair<const pair<Identity, EncodingVersion>, LocatorTablePtr>( + locatorKey, new LocatorTable())); } - _tableHint = _table.insert(_tableHint, - pair<const LocatorPrx, LocatorInfoPtr>(locator, + _tableHint = _table.insert(_tableHint, + pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second, _background))); } @@ -536,15 +537,6 @@ IceInternal::LocatorInfo::operator<(const LocatorInfo& rhs) const return _locator < rhs._locator; } -LocatorPrx -IceInternal::LocatorInfo::getLocator() const -{ - // - // No mutex lock necessary, _locator is immutable. - // - return _locator; -} - LocatorRegistryPrx IceInternal::LocatorInfo::getLocatorRegistry() { diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index 9a863107e38..15d4ad3075a 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -20,6 +20,7 @@ #include <Ice/Identity.h> #include <Ice/EndpointIF.h> #include <Ice/PropertiesF.h> +#include <Ice/Version.h> #include <IceUtil/UniquePtr.h> @@ -47,7 +48,7 @@ private: std::map<Ice::LocatorPrx, LocatorInfoPtr> _table; std::map<Ice::LocatorPrx, LocatorInfoPtr>::iterator _tableHint; - std::map<Ice::Identity, LocatorTablePtr> _locatorTables; + std::map<std::pair<Ice::Identity, Ice::EncodingVersion>, LocatorTablePtr> _locatorTables; }; class LocatorTable : public IceUtil::Shared, public IceUtil::Mutex @@ -143,7 +144,13 @@ public: bool operator!=(const LocatorInfo&) const; bool operator<(const LocatorInfo&) const; - Ice::LocatorPrx getLocator() const; + const Ice::LocatorPrx& getLocator() const + { + // + // No mutex lock necessary, _locator is immutable. + // + return _locator; + } Ice::LocatorRegistryPrx getLocatorRegistry(); std::vector<EndpointIPtr> getEndpoints(const ReferencePtr& ref, int ttl, bool& cached) diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp index 5b3bedbaedd..10b16984b56 100644 --- a/cpp/src/Ice/OpaqueEndpointI.cpp +++ b/cpp/src/Ice/OpaqueEndpointI.cpp @@ -25,7 +25,7 @@ const Ice::EncodingVersion Encoding_0_0 = { 0, 0 }; } IceInternal::OpaqueEndpointI::OpaqueEndpointI(const string& str) : - EndpointI(Protocol_0_0, Encoding_0_0, ""), + EndpointI(""), _rawEncoding(Ice::currentEncoding) { const string delim = " \t\n\r"; @@ -183,7 +183,7 @@ IceInternal::OpaqueEndpointI::OpaqueEndpointI(const string& str) : } IceInternal::OpaqueEndpointI::OpaqueEndpointI(Short type, BasicStream* s) : - EndpointI(Protocol_0_0, Encoding_0_0, ""), + EndpointI(""), _type(type) { _rawEncoding = s->startReadEncaps(); @@ -247,7 +247,7 @@ private: // COMPILERFIX: inlining this constructor causes crashes with gcc 4.0.1. // InfoI::InfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, const Ice::ByteSeq& rawBytes) : - Ice::OpaqueEndpointInfo(Protocol_0_0, Encoding_0_0, -1, false, rawEncoding, rawBytes), + Ice::OpaqueEndpointInfo(-1, false, rawEncoding, rawBytes), _type(type) { } diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index c46b95bad14..85e15a53509 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -92,6 +92,8 @@ IceInternal::Outgoing::Outgoing(RequestHandler* handler, const string& operation _os(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _sent(false) { + checkSupportedProtocol(handler->getReference()->getProtocol()); + switch(_handler->getReference()->getMode()) { case Reference::ModeTwoway: @@ -561,6 +563,7 @@ IceInternal::BatchOutgoing::BatchOutgoing(RequestHandler* handler, InvocationObs _os(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _observer(observer) { + checkSupportedProtocol(handler->getReference()->getProtocol()); } IceInternal::BatchOutgoing::BatchOutgoing(ConnectionI* connection, Instance* instance, InvocationObserver& observer) : diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 5dd2238944f..33ac9dee0f5 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -438,6 +438,8 @@ IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMod _mode = mode; _sentSynchronously = false; + checkSupportedProtocol(_proxy->__reference()->getProtocol()); + _observer.attach(_proxy.get(), operation, context); // @@ -935,6 +937,8 @@ IceInternal::ProxyBatchOutgoingAsync::ProxyBatchOutgoingAsync(const Ice::ObjectP void IceInternal::ProxyBatchOutgoingAsync::__send() { + checkSupportedProtocol(_proxy->__reference()->getProtocol()); + // // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch // requests were queued with the connection, they would be lost without being noticed. diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index e9e05239474..62d94b80fa7 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Oct 22 18:48:40 2012 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Nov 12 21:17:34 2012 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -27,7 +27,6 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Admin.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Admin.Locator.Locator", false, 0), IceInternal::Property("Ice.Admin.Locator.Router", false, 0), - IceInternal::Property("Ice.Admin.Locator.EncodingVersion", false, 0), IceInternal::Property("Ice.Admin.Locator.CollocationOptimized", false, 0), IceInternal::Property("Ice.Admin.Locator", false, 0), IceInternal::Property("Ice.Admin.PublishedEndpoints", false, 0), @@ -38,7 +37,6 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Admin.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Admin.Router.Locator", false, 0), IceInternal::Property("Ice.Admin.Router.Router", false, 0), - IceInternal::Property("Ice.Admin.Router.EncodingVersion", false, 0), IceInternal::Property("Ice.Admin.Router.CollocationOptimized", false, 0), IceInternal::Property("Ice.Admin.Router", false, 0), IceInternal::Property("Ice.Admin.ProxyOptions", false, 0), @@ -69,7 +67,6 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Default.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Default.Locator.Locator", false, 0), IceInternal::Property("Ice.Default.Locator.Router", false, 0), - IceInternal::Property("Ice.Default.Locator.EncodingVersion", false, 0), IceInternal::Property("Ice.Default.Locator.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.Locator", false, 0), IceInternal::Property("Ice.Default.LocatorCacheTimeout", false, 0), @@ -82,7 +79,6 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Default.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Ice.Default.Router.Locator", false, 0), IceInternal::Property("Ice.Default.Router.Router", false, 0), - IceInternal::Property("Ice.Default.Router.EncodingVersion", false, 0), IceInternal::Property("Ice.Default.Router.CollocationOptimized", false, 0), IceInternal::Property("Ice.Default.Router", false, 0), IceInternal::Property("Ice.Default.SlicedFormat", false, 0), @@ -188,7 +184,6 @@ const IceInternal::Property IceBoxPropsData[] = IceInternal::Property("IceBox.ServiceManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.Router", false, 0), - IceInternal::Property("IceBox.ServiceManager.Locator.EncodingVersion", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceBox.ServiceManager.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.PublishedEndpoints", false, 0), @@ -199,7 +194,6 @@ const IceInternal::Property IceBoxPropsData[] = IceInternal::Property("IceBox.ServiceManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.Locator", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.Router", false, 0), - IceInternal::Property("IceBox.ServiceManager.Router.EncodingVersion", false, 0), IceInternal::Property("IceBox.ServiceManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceBox.ServiceManager.Router", false, 0), IceInternal::Property("IceBox.ServiceManager.ProxyOptions", false, 0), @@ -226,7 +220,6 @@ const IceInternal::Property IceBoxAdminPropsData[] = IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.LocatorCacheTimeout", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.Locator", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.Router", false, 0), - IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.EncodingVersion", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy.CollocationOptimized", false, 0), IceInternal::Property("IceBoxAdmin.ServiceManager.Proxy", false, 0), }; @@ -261,7 +254,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Node.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Node.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Node.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Node.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.Locator", false, 0), IceInternal::Property("IceGrid.Node.PublishedEndpoints", false, 0), @@ -272,7 +264,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Node.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.Router.Locator", false, 0), IceInternal::Property("IceGrid.Node.Router.Router", false, 0), - IceInternal::Property("IceGrid.Node.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Node.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.Router", false, 0), IceInternal::Property("IceGrid.Node.ProxyOptions", false, 0), @@ -306,7 +297,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Node.UserAccountMapper.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.Locator", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.Router", false, 0), - IceInternal::Property("IceGrid.Node.UserAccountMapper.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Node.UserAccountMapper", false, 0), IceInternal::Property("IceGrid.Node.WaitTime", false, 0), @@ -317,7 +307,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.Router", false, 0), - IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionFilters", false, 0), @@ -330,7 +319,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.PublishedEndpoints", false, 0), @@ -341,7 +329,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.Router", false, 0), - IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.Router", false, 0), IceInternal::Property("IceGrid.Registry.AdminSessionManager.ProxyOptions", false, 0), @@ -358,7 +345,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.Router", false, 0), - IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.AdminSSLPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.Client.ACM", false, 0), @@ -370,7 +356,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Client.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Client.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Client.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.PublishedEndpoints", false, 0), @@ -381,7 +366,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Client.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Client.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Client.Router", false, 0), IceInternal::Property("IceGrid.Registry.Client.ProxyOptions", false, 0), @@ -405,7 +389,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Internal.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Internal.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.PublishedEndpoints", false, 0), @@ -416,7 +399,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Internal.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Internal.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Internal.Router", false, 0), IceInternal::Property("IceGrid.Registry.Internal.ProxyOptions", false, 0), @@ -434,7 +416,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.PermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.Router", false, 0), - IceInternal::Property("IceGrid.Registry.PermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.PermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.ReplicaName", false, 0), @@ -450,7 +431,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Server.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Server.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Server.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.PublishedEndpoints", false, 0), @@ -461,7 +441,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Server.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.Router", false, 0), - IceInternal::Property("IceGrid.Registry.Server.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.Server.Router", false, 0), IceInternal::Property("IceGrid.Registry.Server.ProxyOptions", false, 0), @@ -482,7 +461,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.SessionManager.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.Router", false, 0), - IceInternal::Property("IceGrid.Registry.SessionManager.Locator.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.PublishedEndpoints", false, 0), @@ -493,7 +471,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.SessionManager.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.Router", false, 0), - IceInternal::Property("IceGrid.Registry.SessionManager.Router.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.Router", false, 0), IceInternal::Property("IceGrid.Registry.SessionManager.ProxyOptions", false, 0), @@ -511,7 +488,6 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.Router", false, 0), - IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("IceGrid.Registry.SSLPermissionsVerifier", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Application", false, 0), @@ -551,7 +527,6 @@ const IceInternal::Property IcePatch2PropsData[] = IceInternal::Property("IcePatch2.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("IcePatch2.Locator.Locator", false, 0), IceInternal::Property("IcePatch2.Locator.Router", false, 0), - IceInternal::Property("IcePatch2.Locator.EncodingVersion", false, 0), IceInternal::Property("IcePatch2.Locator.CollocationOptimized", false, 0), IceInternal::Property("IcePatch2.Locator", false, 0), IceInternal::Property("IcePatch2.PublishedEndpoints", false, 0), @@ -562,7 +537,6 @@ const IceInternal::Property IcePatch2PropsData[] = IceInternal::Property("IcePatch2.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("IcePatch2.Router.Locator", false, 0), IceInternal::Property("IcePatch2.Router.Router", false, 0), - IceInternal::Property("IcePatch2.Router.EncodingVersion", false, 0), IceInternal::Property("IcePatch2.Router.CollocationOptimized", false, 0), IceInternal::Property("IcePatch2.Router", false, 0), IceInternal::Property("IcePatch2.ProxyOptions", false, 0), @@ -658,7 +632,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.Client.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Client.Locator.Locator", false, 0), IceInternal::Property("Glacier2.Client.Locator.Router", false, 0), - IceInternal::Property("Glacier2.Client.Locator.EncodingVersion", false, 0), IceInternal::Property("Glacier2.Client.Locator.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Client.Locator", false, 0), IceInternal::Property("Glacier2.Client.PublishedEndpoints", false, 0), @@ -669,7 +642,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.Client.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Client.Router.Locator", false, 0), IceInternal::Property("Glacier2.Client.Router.Router", false, 0), - IceInternal::Property("Glacier2.Client.Router.EncodingVersion", false, 0), IceInternal::Property("Glacier2.Client.Router.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Client.Router", false, 0), IceInternal::Property("Glacier2.Client.ProxyOptions", false, 0), @@ -702,7 +674,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.PermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.Locator", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.Router", false, 0), - IceInternal::Property("Glacier2.PermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.PermissionsVerifier", false, 0), IceInternal::Property("Glacier2.ReturnClientProxy", false, 0), @@ -712,7 +683,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.SSLPermissionsVerifier.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.Locator", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.Router", false, 0), - IceInternal::Property("Glacier2.SSLPermissionsVerifier.EncodingVersion", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SSLPermissionsVerifier", false, 0), IceInternal::Property("Glacier2.RoutingTable.MaxSize", false, 0), @@ -725,7 +695,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.Server.Locator.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Server.Locator.Locator", false, 0), IceInternal::Property("Glacier2.Server.Locator.Router", false, 0), - IceInternal::Property("Glacier2.Server.Locator.EncodingVersion", false, 0), IceInternal::Property("Glacier2.Server.Locator.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Server.Locator", false, 0), IceInternal::Property("Glacier2.Server.PublishedEndpoints", false, 0), @@ -736,7 +705,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.Server.Router.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.Server.Router.Locator", false, 0), IceInternal::Property("Glacier2.Server.Router.Router", false, 0), - IceInternal::Property("Glacier2.Server.Router.EncodingVersion", false, 0), IceInternal::Property("Glacier2.Server.Router.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.Server.Router", false, 0), IceInternal::Property("Glacier2.Server.ProxyOptions", false, 0), @@ -759,7 +727,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.SessionManager.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SessionManager.Locator", false, 0), IceInternal::Property("Glacier2.SessionManager.Router", false, 0), - IceInternal::Property("Glacier2.SessionManager.EncodingVersion", false, 0), IceInternal::Property("Glacier2.SessionManager.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SessionManager", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.EndpointSelection", false, 0), @@ -768,7 +735,6 @@ const IceInternal::Property Glacier2PropsData[] = IceInternal::Property("Glacier2.SSLSessionManager.LocatorCacheTimeout", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.Locator", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.Router", false, 0), - IceInternal::Property("Glacier2.SSLSessionManager.EncodingVersion", false, 0), IceInternal::Property("Glacier2.SSLSessionManager.CollocationOptimized", false, 0), IceInternal::Property("Glacier2.SSLSessionManager", false, 0), IceInternal::Property("Glacier2.SessionTimeout", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index f8f09b5a81c..f460865f279 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Oct 22 18:48:40 2012 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Nov 12 21:17:34 2012 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -27,9 +27,9 @@ struct Property const char* deprecatedBy; Property(const char* n, bool d, const char* b) : - pattern(n), - deprecated(d), - deprecatedBy(b) + pattern(n), + deprecated(d), + deprecatedBy(b) { } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 8f519f5ca55..7b5b6781867 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -870,7 +870,6 @@ IceProxy::Ice::Object::ice_encodingVersion(const ::Ice::EncodingVersion& encodin } else { - checkSupportedEncoding(encoding); ObjectPrx proxy = __newInstance(); proxy->setup(_reference->changeEncoding(encoding)); return proxy; diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index dadbdf8af0d..a3d9f9478ca 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -143,7 +143,7 @@ IceInternal::Reference::changeEncoding(const Ice::EncodingVersion& encoding) con r->_encoding = encoding; return r; } - + ReferencePtr IceInternal::Reference::changeCompress(bool newCompress) const { @@ -193,6 +193,12 @@ IceInternal::Reference::streamWrite(BasicStream* s) const s->write(_secure); + if(s->getWriteEncoding() != Ice::Encoding_1_0) + { + s->write(_protocol); + s->write(_encoding); + } + // Derived class writes the remainder of the reference. } @@ -282,6 +288,16 @@ IceInternal::Reference::toString() const s << " -s"; } + if(_protocol != Ice::Protocol_1_0) + { + s << " -p " << _protocol; + } + + if(_encoding != Ice::Encoding_1_0) + { + s << " -e " << _encoding; + } + return s.str(); // Derived class writes the remainder of the string. @@ -324,7 +340,12 @@ IceInternal::Reference::operator==(const Reference& r) const return false; } - if(_encoding != r._encoding) + if(_protocol != r._protocol) + { + return false; + } + + if(_encoding != r._encoding) { return false; } @@ -410,11 +431,20 @@ IceInternal::Reference::operator<(const Reference& r) const return false; } - if(_encoding < r._encoding) + if(_protocol < r._protocol) { return true; - } - else if(r._encoding > _encoding) + } + else if(r._protocol < _protocol) + { + return false; + } + + if(_encoding < r._encoding) + { + return true; + } + else if(r._encoding < _encoding) { return false; } @@ -450,6 +480,7 @@ IceInternal::Reference::Reference(const InstancePtr& instance, const string& facet, Mode mode, bool secure, + const ProtocolVersion& protocol, const EncodingVersion& encoding) : _hashInitialized(false), _instance(instance), @@ -459,6 +490,7 @@ IceInternal::Reference::Reference(const InstancePtr& instance, _identity(id), _context(new SharedContext), _facet(facet), + _protocol(protocol), _encoding(encoding), _overrideCompress(false), _compress(false) @@ -474,6 +506,7 @@ IceInternal::Reference::Reference(const Reference& r) : _identity(r._identity), _context(r._context), _facet(r._facet), + _protocol(r._protocol), _encoding(r._encoding), _overrideCompress(r._overrideCompress), _compress(r._compress) @@ -495,6 +528,8 @@ IceInternal::Reference::hashInit() const { hashAdd(h, _compress); } + hashAdd(h, _protocol.major); + hashAdd(h, _protocol.minor); hashAdd(h, _encoding.major); hashAdd(h, _encoding.minor); return h; @@ -510,7 +545,7 @@ IceInternal::FixedReference::FixedReference(const InstancePtr& instance, bool secure, const EncodingVersion& encoding, const ConnectionIPtr& fixedConnection) : - Reference(instance, communicator, id, facet, mode, secure, encoding), + Reference(instance, communicator, id, facet, mode, secure, Ice::Protocol_1_0, encoding), _fixedConnection(fixedConnection) { } @@ -820,7 +855,8 @@ IceInternal::RoutableReference::RoutableReference(const InstancePtr& instance, const string& facet, Mode mode, bool secure, - const EncodingVersion& version, + const ProtocolVersion& protocol, + const EncodingVersion& encoding, const vector<EndpointIPtr>& endpoints, const string& adapterId, const LocatorInfoPtr& locatorInfo, @@ -830,7 +866,7 @@ IceInternal::RoutableReference::RoutableReference(const InstancePtr& instance, bool preferSecure, EndpointSelectionType endpointSelection, int locatorCacheTimeout) : - Reference(instance, communicator, id, facet, mode, secure, version), + Reference(instance, communicator, id, facet, mode, secure, protocol, encoding), _endpoints(endpoints), _adapterId(adapterId), _locatorInfo(locatorInfo), @@ -907,6 +943,21 @@ IceInternal::RoutableReference::getConnectionId() const } ReferencePtr +IceInternal::RoutableReference::changeEncoding(const Ice::EncodingVersion& encoding) const +{ + ReferencePtr r = Reference::changeEncoding(encoding); + if(r.get() != const_cast<RoutableReference*>(this)) + { + LocatorInfoPtr& locInfo = RoutableReferencePtr::dynamicCast(r)->_locatorInfo; + if(locInfo && locInfo->getLocator()->ice_getEncodingVersion() != encoding) + { + locInfo = getInstance()->locatorManager()->get(locInfo->getLocator()->ice_encodingVersion(encoding)); + } + } + return r; +} + +ReferencePtr IceInternal::RoutableReference::changeCompress(bool newCompress) const { ReferencePtr r = Reference::changeCompress(newCompress); @@ -1175,7 +1226,6 @@ IceInternal::RoutableReference::toProperty(const string& prefix) const properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0"; properties[prefix + ".PreferSecure"] = _preferSecure ? "1" : "0"; properties[prefix + ".EndpointSelection"] = _endpointSelection == Random ? "Random" : "Ordered"; - properties[prefix + ".EncodingVersion"] = versionToString(getEncoding()); ostringstream s; s << _locatorCacheTimeout; @@ -1888,20 +1938,14 @@ IceInternal::RoutableReference::RoutableReference(const RoutableReference& r) : namespace { -struct EndpointIsIncompatible : public unary_function<EndpointIPtr, bool> +struct EndpointIsOpaque : public unary_function<EndpointIPtr, bool> { - const Reference* _reference; - - EndpointIsIncompatible(const Reference* reference) : _reference(reference) - { - } +public: bool - operator()(const EndpointIPtr& p) const + operator()(EndpointIPtr p) const { - // If the enpoint doesn't support the proxy encoding or protocol, it's incompatible. - return !(isSupported(_reference->getEncoding(), p->encodingVersion()) && - isSupported(currentProtocol, p->protocolVersion())); + return dynamic_cast<OpaqueEndpointI*>(p.get()) != 0; } }; @@ -1913,10 +1957,9 @@ IceInternal::RoutableReference::filterEndpoints(const vector<EndpointIPtr>& allE vector<EndpointIPtr> endpoints = allEndpoints; // - // Filter out incompatible endpoints (whose encoding/protocol - // versions aren't supported by this runtime, or are opaque). + // Filter out unknown endpoints. // - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), EndpointIsIncompatible(this)), endpoints.end()); + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), EndpointIsOpaque()), endpoints.end()); // // Filter out endpoints according to the mode of the reference. diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 4fad67eab08..ceff28a7c01 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -55,6 +55,7 @@ public: Mode getMode() const { return _mode; } bool getSecure() const { return _secure; } + const Ice::ProtocolVersion& getProtocol() const { return _protocol; } const Ice::EncodingVersion& getEncoding() const { return _encoding; } const Ice::Identity& getIdentity() const { return _identity; } const std::string& getFacet() const { return _facet; } @@ -85,7 +86,7 @@ public: ReferencePtr changeSecure(bool) const; ReferencePtr changeIdentity(const Ice::Identity&) const; ReferencePtr changeFacet(const std::string&) const; - ReferencePtr changeEncoding(const Ice::EncodingVersion&) const; + virtual ReferencePtr changeEncoding(const Ice::EncodingVersion&) const; virtual ReferencePtr changeCompress(bool) const; virtual ReferencePtr changeEndpoints(const std::vector<EndpointIPtr>&) const = 0; @@ -139,7 +140,7 @@ public: protected: Reference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, bool, - const Ice::EncodingVersion&); + const Ice::ProtocolVersion&, const Ice::EncodingVersion&); Reference(const Reference&); virtual Ice::Int hashInit() const; @@ -157,6 +158,7 @@ private: Ice::Identity _identity; SharedContextPtr _context; std::string _facet; + Ice::ProtocolVersion _protocol; Ice::EncodingVersion _encoding; protected: @@ -222,8 +224,9 @@ class RoutableReference : public Reference public: RoutableReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const std::string&, Mode, - bool, const Ice::EncodingVersion&, const std::vector<EndpointIPtr>&, const std::string&, - const LocatorInfoPtr&, const RouterInfoPtr&, bool, bool, bool, Ice::EndpointSelectionType, int); + bool, const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::vector<EndpointIPtr>&, + const std::string&, const LocatorInfoPtr&, const RouterInfoPtr&, bool, bool, bool, + Ice::EndpointSelectionType, int); virtual std::vector<EndpointIPtr> getEndpoints() const; virtual std::string getAdapterId() const; @@ -236,6 +239,7 @@ public: virtual int getLocatorCacheTimeout() const; virtual std::string getConnectionId() const; + virtual ReferencePtr changeEncoding(const Ice::EncodingVersion&) const; virtual ReferencePtr changeCompress(bool) const; virtual ReferencePtr changeEndpoints(const std::vector<EndpointIPtr>&) const; virtual ReferencePtr changeAdapterId(const std::string&) const; diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 37ccafa1976..b4193f3a374 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -55,7 +55,8 @@ IceInternal::ReferenceFactory::create(const Identity& ident, return 0; } - return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), endpoints, "", ""); + return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), + endpoints, "", ""); } ReferencePtr @@ -69,7 +70,8 @@ IceInternal::ReferenceFactory::create(const Identity& ident, return 0; } - return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), vector<EndpointIPtr>(), adapterId, ""); + return create(ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), + vector<EndpointIPtr>(), adapterId, ""); } ReferencePtr @@ -80,8 +82,6 @@ IceInternal::ReferenceFactory::create(const Identity& ident, const Ice::Connecti return 0; } - DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides(); - // // Create new reference // @@ -91,7 +91,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, const Ice::Connecti "", // Facet connection->endpoint()->datagram() ? Reference::ModeDatagram : Reference::ModeTwoway, connection->endpoint()->secure(), - defaultsAndOverrides->defaultEncoding, + _instance->defaultsAndOverrides()->defaultEncoding, connection); } @@ -189,6 +189,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP string facet; Reference::Mode mode = Reference::ModeTwoway; bool secure = false; + Ice::EncodingVersion encoding = _instance->defaultsAndOverrides()->defaultEncoding; string adapter; while(true) @@ -362,6 +363,28 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP break; } + case 'e': + { + if(argument.empty()) + { + Ice::ProxyParseException ex(__FILE__, __LINE__); + ex.str = "no argument provided for -e option in `" + s + "'"; + throw ex; + } + + try + { + encoding = Ice::stringToEncodingVersion(argument); + } + catch(const Ice::VersionParseException& e) + { + Ice::ProxyParseException ex(__FILE__, __LINE__); + ex.str = "invalid encoding version `" + argument + "' in `" + s + "':\n" + e.str; + throw ex; + } + break; + } + default: { ProxyParseException ex(__FILE__, __LINE__); @@ -371,14 +394,12 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP } } - if(beg == string::npos) { - return create(ident, facet, mode, secure, vector<EndpointIPtr>(), "", propertyPrefix); + return create(ident, facet, mode, secure, Protocol_1_0, encoding, vector<EndpointIPtr>(), "", propertyPrefix); } vector<EndpointIPtr> endpoints; - switch(s[beg]) { case ':': @@ -463,7 +484,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP } } - return create(ident, facet, mode, secure, endpoints, "", propertyPrefix); + return create(ident, facet, mode, secure, Protocol_1_0, encoding, endpoints, "", propertyPrefix); break; } case '@': @@ -527,7 +548,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP adapter = Ice::UTF8ToNative(_instance->initializationData().stringConverter, adapter); - return create(ident, facet, mode, secure, vector<EndpointIPtr>(), adapter, propertyPrefix); + return create(ident, facet, mode, secure, Protocol_1_0, encoding, endpoints, adapter, propertyPrefix); break; } default: @@ -580,6 +601,19 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s) bool secure; s->read(secure); + Ice::ProtocolVersion protocol; + Ice::EncodingVersion encoding; + if(s->getReadEncoding() != Ice::Encoding_1_0) + { + s->read(protocol); + s->read(encoding); + } + else + { + protocol = Ice::Protocol_1_0; + encoding = Ice::Encoding_1_0; + } + vector<EndpointIPtr> endpoints; string adapterId; @@ -599,7 +633,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s) s->read(adapterId); } - return create(ident, facet, mode, secure, endpoints, adapterId, ""); + return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, ""); } ReferenceFactoryPtr @@ -656,7 +690,6 @@ IceInternal::ReferenceFactory::checkForUnknownProperties(const string& prefix) "EndpointSelection", "ConnectionCached", "PreferSecure", - "EncodingVersion", "LocatorCacheTimeout", "Locator", "Router", @@ -711,6 +744,8 @@ IceInternal::ReferenceFactory::create(const Identity& ident, const string& facet, Reference::Mode mode, bool secure, + const Ice::ProtocolVersion& protocol, + const Ice::EncodingVersion& encoding, const vector<EndpointIPtr>& endpoints, const string& adapterId, const string& propertyPrefix) @@ -720,12 +755,22 @@ IceInternal::ReferenceFactory::create(const Identity& ident, // // Default local proxy options. // - LocatorInfoPtr locatorInfo = _instance->locatorManager()->get(_defaultLocator); + LocatorInfoPtr locatorInfo; + if(_defaultLocator) + { + if(_defaultLocator->ice_getEncodingVersion() != encoding) + { + locatorInfo = _instance->locatorManager()->get(_defaultLocator->ice_encodingVersion(encoding)); + } + else + { + locatorInfo = _instance->locatorManager()->get(_defaultLocator); + } + } RouterInfoPtr routerInfo = _instance->routerManager()->get(_defaultRouter); bool collocationOptimized = defaultsAndOverrides->defaultCollocationOptimization; bool cacheConnection = true; bool preferSecure = defaultsAndOverrides->defaultPreferSecure; - EncodingVersion encoding = defaultsAndOverrides->defaultEncoding; Ice::EndpointSelectionType endpointSelection = defaultsAndOverrides->defaultEndpointSelection; int locatorCacheTimeout = defaultsAndOverrides->defaultLocatorCacheTimeout; @@ -746,7 +791,14 @@ IceInternal::ReferenceFactory::create(const Identity& ident, LocatorPrx locator = LocatorPrx::uncheckedCast(_communicator->propertyToProxy(property)); if(locator) { - locatorInfo = _instance->locatorManager()->get(locator); + if(locator->ice_getEncodingVersion() != encoding) + { + locatorInfo = _instance->locatorManager()->get(locator->ice_encodingVersion(encoding)); + } + else + { + locatorInfo = _instance->locatorManager()->get(locator); + } } property = propertyPrefix + ".Router"; @@ -774,14 +826,6 @@ IceInternal::ReferenceFactory::create(const Identity& ident, property = propertyPrefix + ".PreferSecure"; preferSecure = properties->getPropertyAsIntWithDefault(property, preferSecure) > 0; - property = propertyPrefix + ".EncodingVersion"; - string encodingStr = properties->getProperty(property); - if(!encodingStr.empty()) - { - encoding = stringToEncodingVersion(encodingStr); - checkSupportedEncoding(encoding); - } - property = propertyPrefix + ".EndpointSelection"; if(!properties->getProperty(property).empty()) { @@ -815,6 +859,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, facet, mode, secure, + protocol, encoding, endpoints, adapterId, diff --git a/cpp/src/Ice/ReferenceFactory.h b/cpp/src/Ice/ReferenceFactory.h index dd1982f96de..6542b062887 100644 --- a/cpp/src/Ice/ReferenceFactory.h +++ b/cpp/src/Ice/ReferenceFactory.h @@ -67,6 +67,7 @@ private: void checkForUnknownProperties(const std::string&); RoutableReferencePtr create(const ::Ice::Identity&, const ::std::string&, Reference::Mode, bool, + const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::vector<EndpointIPtr>&, const std::string&, const std::string&); const InstancePtr _instance; diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 291e0ec03d9..84feadb9869 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -142,15 +142,6 @@ IceInternal::RouterInfo::operator<(const RouterInfo& rhs) const return _router < rhs._router; } -RouterPrx -IceInternal::RouterInfo::getRouter() const -{ - // - // No mutex lock necessary, _router is immutable. - // - return _router; -} - vector<EndpointIPtr> IceInternal::RouterInfo::getClientEndpoints() { diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index c1b1077a73b..7caaafc97cf 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -76,7 +76,13 @@ public: bool operator!=(const RouterInfo&) const; bool operator<(const RouterInfo&) const; - Ice::RouterPrx getRouter() const; + const Ice::RouterPrx& getRouter() const + { + // + // No mutex lock necessary, _router is immutable. + // + return _router; + } void getClientProxyResponse(const Ice::ObjectPrx&, const GetClientEndpointsCallbackPtr&); void getClientProxyException(const Ice::Exception&, const GetClientEndpointsCallbackPtr&); std::vector<EndpointIPtr> getClientEndpoints(); diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp index a3211c28eb7..7c4dedb9cf2 100644 --- a/cpp/src/Ice/TcpConnector.cpp +++ b/cpp/src/Ice/TcpConnector.cpp @@ -77,16 +77,6 @@ IceInternal::TcpConnector::operator==(const Connector& r) const return false; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_connectionId != p->_connectionId) { return false; @@ -119,24 +109,6 @@ IceInternal::TcpConnector::operator<(const Connector& r) const return false; } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_connectionId < p->_connectionId) { return true; @@ -149,15 +121,12 @@ IceInternal::TcpConnector::operator<(const Connector& r) const } IceInternal::TcpConnector::TcpConnector(const InstancePtr& instance, const Address& addr, - Ice::Int timeout, const Ice::ProtocolVersion& protocol, - const Ice::EncodingVersion& encoding, const string& connectionId) : + Ice::Int timeout, const string& connectionId) : _instance(instance), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), _addr(addr), _timeout(timeout), - _protocol(protocol), - _encoding(encoding), _connectionId(connectionId) { } diff --git a/cpp/src/Ice/TcpConnector.h b/cpp/src/Ice/TcpConnector.h index 341696087ef..6a1d5fdab50 100644 --- a/cpp/src/Ice/TcpConnector.h +++ b/cpp/src/Ice/TcpConnector.h @@ -36,8 +36,7 @@ public: private: - TcpConnector(const InstancePtr&, const Address&, Ice::Int, const Ice::ProtocolVersion&, - const Ice::EncodingVersion&, const std::string&); + TcpConnector(const InstancePtr&, const Address&, Ice::Int, const std::string&); virtual ~TcpConnector(); friend class TcpEndpointI; @@ -46,8 +45,6 @@ private: const ::Ice::LoggerPtr _logger; const Address _addr; const Ice::Int _timeout; - const Ice::ProtocolVersion _protocol; - const Ice::EncodingVersion _encoding; const std::string _connectionId; }; diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 1eac94a8988..f69cfb1094b 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -23,9 +23,8 @@ using namespace Ice; using namespace IceInternal; IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, - const Ice::ProtocolVersion& protocol, const Ice::EncodingVersion& encoding, const string& conId, bool co) : - EndpointI(protocol, encoding, conId), + EndpointI(conId), _instance(instance), _host(ho), _port(po), @@ -35,7 +34,7 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin } IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : - EndpointI(Ice::currentProtocol, instance->defaultsAndOverrides()->defaultEncoding, ""), + EndpointI(""), _instance(instance), _port(0), _timeout(-1), @@ -155,7 +154,9 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin default: { - parseOption(option, argument, "tcp", str); + Ice::EndpointParseException ex(__FILE__, __LINE__); + ex.str = "unknown option `" + option + "' in endpoint `tcp " + str + "'"; + throw ex; } } } @@ -190,16 +191,6 @@ IceInternal::TcpEndpointI::TcpEndpointI(BasicStream* s) : s->read(const_cast<Int&>(_port)); s->read(const_cast<Int&>(_timeout)); s->read(const_cast<bool&>(_compress)); - if(s->getReadEncoding() > Ice::Encoding_1_0) - { - s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); - s->read(const_cast<Ice::EncodingVersion&>(_encoding)); - } - else - { - const_cast<ProtocolVersion&>(_protocol) = Ice::Protocol_1_0; - const_cast<EncodingVersion&>(_encoding) = Ice::Encoding_1_0; - } s->endReadEncaps(); } @@ -212,11 +203,6 @@ IceInternal::TcpEndpointI::streamWrite(BasicStream* s) const s->write(_port); s->write(_timeout); s->write(_compress); - if(s->getWriteEncoding() > Ice::Encoding_1_0) - { - s->write(_protocol); - s->write(_encoding); - } s->endWriteEncaps(); } @@ -233,16 +219,6 @@ IceInternal::TcpEndpointI::toString() const ostringstream s; s << "tcp"; - if(_protocol != Ice::Protocol_1_0) - { - s << " -v " << _protocol; - } - - if(_encoding != Ice::Encoding_1_0) - { - s << " -e " << _encoding; - } - if(!_host.empty()) { s << " -h "; @@ -277,9 +253,8 @@ IceInternal::TcpEndpointI::getInfo() const { public: - InfoI(const ProtocolVersion& pv, const EncodingVersion& ev, Ice::Int to, bool comp, const string& host, - Ice::Int port) : - TCPEndpointInfo(pv, ev, to, comp, host, port) + InfoI(Ice::Int to, bool comp, const string& host, Ice::Int port) : + TCPEndpointInfo(to, comp, host, port) { } @@ -302,7 +277,7 @@ IceInternal::TcpEndpointI::getInfo() const } }; - return new InfoI(_protocol, _encoding, _timeout, _compress, _host, _port); + return new InfoI(_timeout, _compress, _host, _port); } Short @@ -332,7 +307,7 @@ IceInternal::TcpEndpointI::timeout(Int timeout) const } else { - return new TcpEndpointI(_instance, _host, _port, timeout, _protocol, _encoding, _connectionId, _compress); + return new TcpEndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } @@ -345,7 +320,7 @@ IceInternal::TcpEndpointI::connectionId(const string& connectionId) const } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, connectionId, _compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -364,7 +339,7 @@ IceInternal::TcpEndpointI::compress(bool compress) const } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, _connectionId, compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } @@ -403,8 +378,8 @@ AcceptorPtr IceInternal::TcpEndpointI::acceptor(EndpointIPtr& endp, const string&) const { TcpAcceptor* p = new TcpAcceptor(_instance, _host, _port, _instance->protocolSupport()); - endp = new TcpEndpointI(_instance, _host, p->effectivePort(), _timeout, _protocol, _encoding, _connectionId, - _compress); + + endp = new TcpEndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress); return p; } @@ -422,8 +397,7 @@ IceInternal::TcpEndpointI::expand() const { for(vector<string>::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { - endps.push_back(new TcpEndpointI(_instance, *p, _port, _timeout, _protocol, _encoding, _connectionId, - _compress)); + endps.push_back(new TcpEndpointI(_instance, *p, _port, _timeout, _connectionId, _compress)); } } return endps; @@ -454,16 +428,6 @@ IceInternal::TcpEndpointI::operator==(const LocalObject& r) const return true; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_host != p->_host) { return false; @@ -511,24 +475,6 @@ IceInternal::TcpEndpointI::operator<(const LocalObject& r) const return false; } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_host < p->_host) { return true; @@ -585,10 +531,6 @@ IceInternal::TcpEndpointI::hashInit() const hashAdd(h, _host); hashAdd(h, _port); hashAdd(h, _timeout); - hashAdd(h, _protocol.major); - hashAdd(h, _protocol.minor); - hashAdd(h, _encoding.major); - hashAdd(h, _encoding.minor); hashAdd(h, _connectionId); hashAdd(h, _compress); return h; @@ -600,7 +542,7 @@ IceInternal::TcpEndpointI::connectors(const vector<Address>& addresses) const vector<ConnectorPtr> connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { - connectors.push_back(new TcpConnector(_instance, addresses[i], _timeout, _protocol, _encoding, _connectionId)); + connectors.push_back(new TcpConnector(_instance, addresses[i], _timeout, _connectionId)); } return connectors; } diff --git a/cpp/src/Ice/TcpEndpointI.h b/cpp/src/Ice/TcpEndpointI.h index feaba9879a2..c1d410ebacd 100644 --- a/cpp/src/Ice/TcpEndpointI.h +++ b/cpp/src/Ice/TcpEndpointI.h @@ -22,8 +22,7 @@ class TcpEndpointI : public EndpointI { public: - TcpEndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const Ice::ProtocolVersion&, - const Ice::EncodingVersion&, const std::string&, bool); + TcpEndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool); TcpEndpointI(const InstancePtr&, const std::string&, bool); TcpEndpointI(BasicStream*); diff --git a/cpp/src/Ice/UdpConnector.cpp b/cpp/src/Ice/UdpConnector.cpp index 29782122b53..b52c5a44bd6 100644 --- a/cpp/src/Ice/UdpConnector.cpp +++ b/cpp/src/Ice/UdpConnector.cpp @@ -48,16 +48,6 @@ IceInternal::UdpConnector::operator==(const Connector& r) const return false; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_connectionId != p->_connectionId) { return false; @@ -91,24 +81,6 @@ IceInternal::UdpConnector::operator<(const Connector& r) const return type() < r.type(); } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_connectionId < p->_connectionId) { return true; @@ -139,15 +111,11 @@ IceInternal::UdpConnector::operator<(const Connector& r) const } IceInternal::UdpConnector::UdpConnector(const InstancePtr& instance, const Address& addr, - const string& mcastInterface, int mcastTtl, - const Ice::ProtocolVersion& protocol, const Ice::EncodingVersion& encoding, - const std::string& connectionId) : + const string& mcastInterface, int mcastTtl, const std::string& connectionId) : _instance(instance), _addr(addr), _mcastInterface(mcastInterface), _mcastTtl(mcastTtl), - _protocol(protocol), - _encoding(encoding), _connectionId(connectionId) { } diff --git a/cpp/src/Ice/UdpConnector.h b/cpp/src/Ice/UdpConnector.h index 148c767407b..e325e5007b6 100644 --- a/cpp/src/Ice/UdpConnector.h +++ b/cpp/src/Ice/UdpConnector.h @@ -34,8 +34,7 @@ public: private: - UdpConnector(const InstancePtr&, const Address&, const std::string&, int, - const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::string&); + UdpConnector(const InstancePtr&, const Address&, const std::string&, int, const std::string&); virtual ~UdpConnector(); friend class UdpEndpointI; @@ -44,8 +43,6 @@ private: const Address _addr; const std::string _mcastInterface; const int _mcastTtl; - const Ice::ProtocolVersion _protocol; - const Ice::EncodingVersion _encoding; const std::string _connectionId; }; diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index 8f508a98c0d..8d812e591dc 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -17,15 +17,15 @@ #include <Ice/DefaultsAndOverrides.h> #include <Ice/Protocol.h> #include <Ice/HashUtil.h> +#include <Ice/Logger.h> using namespace std; using namespace Ice; using namespace IceInternal; IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& ho, Int po, const string& mif, - Int mttl, const Ice::ProtocolVersion& protocol, - const Ice::EncodingVersion& encoding, bool conn, const string& conId, bool co) : - EndpointI(protocol, encoding, conId), + Int mttl, bool conn, const string& conId, bool co) : + EndpointI(conId), _instance(instance), _host(ho), _port(po), @@ -37,7 +37,7 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin } IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : - EndpointI(Ice::currentProtocol, instance->defaultsAndOverrides()->defaultEncoding, ""), + EndpointI(""), _instance(instance), _port(0), _mcastTtl(-1), @@ -157,6 +157,14 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin } const_cast<bool&>(_compress) = true; } + else if(option == "-v") + { + _instance->initializationData().logger->warning("deprecated udp endpoint option: -v"); + } + else if(option == "-e") + { + _instance->initializationData().logger->warning("deprecated udp endpoint option: -e"); + } else if(option == "--interface") { if(argument.empty()) @@ -185,7 +193,9 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin } else { - parseOption(option, argument, "udp", str); + Ice::EndpointParseException ex(__FILE__, __LINE__); + ex.str = "unknown option `" + option + "' in endpoint `udp " + str + "'"; + throw ex; } } @@ -218,8 +228,14 @@ IceInternal::UdpEndpointI::UdpEndpointI(BasicStream* s) : s->startReadEncaps(); s->read(const_cast<string&>(_host), false); s->read(const_cast<Int&>(_port)); - s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); - s->read(const_cast<Ice::EncodingVersion&>(_encoding)); + if(s->getReadEncoding() == Ice::Encoding_1_0) + { + Ice::Byte b; + s->read(b); + s->read(b); + s->read(b); + s->read(b); + } // Not transmitted. //s->read(const_cast<bool&>(_connect)); s->read(const_cast<bool&>(_compress)); @@ -233,8 +249,11 @@ IceInternal::UdpEndpointI::streamWrite(BasicStream* s) const s->startWriteEncaps(); s->write(_host, false); s->write(_port); - s->write(_protocol); - s->write(_encoding); + if(s->getWriteEncoding() == Ice::Encoding_1_0) + { + s->write(Ice::Protocol_1_0); + s->write(Ice::Encoding_1_0); + } // Not transmitted. //s->write(_connect); s->write(_compress); @@ -255,16 +274,6 @@ IceInternal::UdpEndpointI::toString() const s << "udp"; - if(_protocol != Ice::Protocol_1_0) - { - s << " -v " << _protocol; - } - - if(_encoding != Ice::Encoding_1_0) - { - s << " -e " << _encoding; - } - if(!_host.empty()) { s << " -h "; @@ -312,9 +321,8 @@ IceInternal::UdpEndpointI::getInfo() const { public: - InfoI(const ProtocolVersion& pv, const EncodingVersion& ev, bool comp, const string& host, Ice::Int port, - const std::string& mcastInterface, Ice::Int mcastTtl) : - UDPEndpointInfo(pv, ev, -1, comp, host, port, mcastInterface, mcastTtl) + InfoI(bool comp, const string& host, Ice::Int port, const std::string& mcastInterface, Ice::Int mcastTtl) : + UDPEndpointInfo(-1, comp, host, port, mcastInterface, mcastTtl) { } @@ -337,7 +345,7 @@ IceInternal::UdpEndpointI::getInfo() const } }; - return new InfoI(_protocol, _encoding, _compress, _host, _port, _mcastInterface, _mcastTtl); + return new InfoI(_compress, _host, _port, _mcastInterface, _mcastTtl); } Short @@ -373,8 +381,7 @@ IceInternal::UdpEndpointI::connectionId(const string& connectionId) const } else { - return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _protocol, _encoding, _connect, - connectionId, _compress); + return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, connectionId, _compress); } } @@ -393,8 +400,7 @@ IceInternal::UdpEndpointI::compress(bool compress) const } else { - return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _protocol, _encoding, _connect, - _connectionId, compress); + return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, compress); } } @@ -414,8 +420,8 @@ TransceiverPtr IceInternal::UdpEndpointI::transceiver(EndpointIPtr& endp) const { UdpTransceiver* p = new UdpTransceiver(_instance, _host, _port, _mcastInterface, _connect); - endp = new UdpEndpointI(_instance, _host, p->effectivePort(), _mcastInterface, _mcastTtl, _protocol, _encoding, - _connect, _connectionId, _compress); + endp = new UdpEndpointI(_instance, _host, p->effectivePort(), _mcastInterface, _mcastTtl, _connect, _connectionId, + _compress); return p; } @@ -451,8 +457,8 @@ IceInternal::UdpEndpointI::expand() const { for(vector<string>::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { - endps.push_back(new UdpEndpointI(_instance, *p, _port, _mcastInterface, _mcastTtl, _protocol, _encoding, - _connect, _connectionId, _compress)); + endps.push_back(new UdpEndpointI(_instance, *p, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, + _compress)); } } return endps; @@ -483,16 +489,6 @@ IceInternal::UdpEndpointI::operator==(const LocalObject& r) const return true; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_host != p->_host) { return false; @@ -550,24 +546,6 @@ IceInternal::UdpEndpointI::operator<(const LocalObject& r) const return false; } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_host < p->_host) { return true; @@ -644,10 +622,6 @@ IceInternal::UdpEndpointI::hashInit() const hashAdd(h, _mcastInterface); hashAdd(h, _mcastTtl); hashAdd(h, _connect); - hashAdd(h, _protocol.major); - hashAdd(h, _protocol.minor); - hashAdd(h, _encoding.major); - hashAdd(h, _encoding.minor); hashAdd(h, _connectionId); hashAdd(h, _compress); return h; @@ -659,8 +633,7 @@ IceInternal::UdpEndpointI::connectors(const vector<Address>& addresses) const vector<ConnectorPtr> connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { - connectors.push_back(new UdpConnector(_instance, addresses[i], _mcastInterface, _mcastTtl, _protocol, _encoding, - _connectionId)); + connectors.push_back(new UdpConnector(_instance, addresses[i], _mcastInterface, _mcastTtl, _connectionId)); } return connectors; } diff --git a/cpp/src/Ice/UdpEndpointI.h b/cpp/src/Ice/UdpEndpointI.h index dccdf28e796..765396cc436 100644 --- a/cpp/src/Ice/UdpEndpointI.h +++ b/cpp/src/Ice/UdpEndpointI.h @@ -22,8 +22,8 @@ class UdpEndpointI : public EndpointI { public: - UdpEndpointI(const InstancePtr&, const std::string&, Ice::Int, const std::string&, Ice::Int, - const Ice::ProtocolVersion&, const Ice::EncodingVersion&, bool, const std::string&, bool); + UdpEndpointI(const InstancePtr&, const std::string&, Ice::Int, const std::string&, Ice::Int, bool, + const std::string&, bool); UdpEndpointI(const InstancePtr&, const std::string&, bool); UdpEndpointI(BasicStream*); diff --git a/cpp/src/IceSSL/ConnectorI.cpp b/cpp/src/IceSSL/ConnectorI.cpp index 8c9857880fa..c881e5574f6 100644 --- a/cpp/src/IceSSL/ConnectorI.cpp +++ b/cpp/src/IceSSL/ConnectorI.cpp @@ -86,16 +86,6 @@ IceSSL::ConnectorI::operator==(const IceInternal::Connector& r) const return false; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_connectionId != p->_connectionId) { return false; @@ -128,24 +118,6 @@ IceSSL::ConnectorI::operator<(const IceInternal::Connector& r) const return false; } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_connectionId < p->_connectionId) { return true; @@ -159,15 +131,12 @@ IceSSL::ConnectorI::operator<(const IceInternal::Connector& r) const } IceSSL::ConnectorI::ConnectorI(const InstancePtr& instance, const string& host, const struct sockaddr_storage& addr, - Ice::Int timeout, const Ice::ProtocolVersion& protocol, - const Ice::EncodingVersion& encoding, const string& connectionId) : + Ice::Int timeout, const string& connectionId) : _instance(instance), _logger(instance->communicator()->getLogger()), _host(host), _addr(addr), _timeout(timeout), - _protocol(protocol), - _encoding(encoding), _connectionId(connectionId) { } diff --git a/cpp/src/IceSSL/ConnectorI.h b/cpp/src/IceSSL/ConnectorI.h index 5e00e714678..8a32689aeb7 100644 --- a/cpp/src/IceSSL/ConnectorI.h +++ b/cpp/src/IceSSL/ConnectorI.h @@ -42,8 +42,7 @@ public: private: - ConnectorI(const InstancePtr&, const std::string&, const struct sockaddr_storage&, Ice::Int, - const Ice::ProtocolVersion&, const Ice::EncodingVersion&, const std::string&); + ConnectorI(const InstancePtr&, const std::string&, const struct sockaddr_storage&, Ice::Int, const std::string&); virtual ~ConnectorI(); friend class EndpointI; @@ -52,8 +51,6 @@ private: const std::string _host; struct sockaddr_storage _addr; const Ice::Int _timeout; - const Ice::ProtocolVersion _protocol; - const Ice::EncodingVersion _encoding; const std::string _connectionId; }; diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index 5c15d89fdd3..a433b3259d1 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -23,10 +23,9 @@ using namespace std; using namespace Ice; using namespace IceSSL; -IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, - const Ice::ProtocolVersion& protocol, const Ice::EncodingVersion& encoding, - const string& conId, bool co) : - IceInternal::EndpointI(protocol, encoding, conId), +IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, const string& conId, + bool co) : + IceInternal::EndpointI(conId), _instance(instance), _host(ho), _port(po), @@ -36,7 +35,7 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int } IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str, bool oaEndpoint) : - IceInternal::EndpointI(Ice::currentProtocol, instance->defaultEncoding(), ""), + IceInternal::EndpointI(""), _instance(instance), _port(0), _timeout(-1), @@ -156,7 +155,9 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str, boo default: { - parseOption(option, argument, "ssl", str); + Ice::EndpointParseException ex(__FILE__, __LINE__); + ex.str = "unknown option `" + option + "' in endpoint `ssl " + str + "'"; + throw ex; } } } @@ -191,16 +192,6 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, IceInternal::BasicStre s->read(const_cast<Int&>(_port)); s->read(const_cast<Int&>(_timeout)); s->read(const_cast<bool&>(_compress)); - if(s->getReadEncoding() > Ice::Encoding_1_0) - { - s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); - s->read(const_cast<Ice::EncodingVersion&>(_encoding)); - } - else - { - const_cast<ProtocolVersion&>(_protocol) = Ice::Protocol_1_0; - const_cast<EncodingVersion&>(_encoding) = Ice::Encoding_1_0; - } s->endReadEncaps(); } @@ -213,11 +204,6 @@ IceSSL::EndpointI::streamWrite(IceInternal::BasicStream* s) const s->write(_port); s->write(_timeout); s->write(_compress); - if(s->getWriteEncoding() > Ice::Encoding_1_0) - { - s->write(_protocol); - s->write(_encoding); - } s->endWriteEncaps(); } @@ -234,16 +220,6 @@ IceSSL::EndpointI::toString() const ostringstream s; s << "ssl"; - if(_protocol != Ice::Protocol_1_0) - { - s << " -v " << _protocol; - } - - if(_encoding != Ice::Encoding_1_0) - { - s << " -e " << _encoding; - } - if(!_host.empty()) { s << " -h "; @@ -278,8 +254,7 @@ IceSSL::EndpointI::getInfo() const { public: - InfoI(const ProtocolVersion& pv, const EncodingVersion& ev, Int to, bool comp, const string& host, Int port) : - IceSSL::EndpointInfo(pv, ev, to, comp, host, port) + InfoI(Int to, bool comp, const string& host, Int port) : IceSSL::EndpointInfo(to, comp, host, port) { } @@ -301,7 +276,7 @@ IceSSL::EndpointI::getInfo() const return true; } }; - return new InfoI(_protocol, _encoding, _timeout, _compress, _host, _port); + return new InfoI(_timeout, _compress, _host, _port); } Short @@ -331,7 +306,7 @@ IceSSL::EndpointI::timeout(Int timeout) const } else { - return new EndpointI(_instance, _host, _port, timeout, _protocol, _encoding, _connectionId, _compress); + return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } @@ -344,7 +319,7 @@ IceSSL::EndpointI::connectionId(const string& connectionId) const } else { - return new EndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, connectionId, _compress); + return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -363,7 +338,7 @@ IceSSL::EndpointI::compress(bool compress) const } else { - return new EndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, _connectionId, compress); + return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } @@ -402,8 +377,7 @@ IceInternal::AcceptorPtr IceSSL::EndpointI::acceptor(IceInternal::EndpointIPtr& endp, const string& adapterName) const { AcceptorI* p = new AcceptorI(_instance, adapterName, _host, _port); - endp = new EndpointI(_instance, _host, p->effectivePort(), _timeout, _protocol, _encoding, _connectionId, - _compress); + endp = new EndpointI(_instance, _host, p->effectivePort(), _timeout, _connectionId, _compress); return p; } @@ -420,8 +394,7 @@ IceSSL::EndpointI::expand() const { for(vector<string>::const_iterator p = hosts.begin(); p != hosts.end(); ++p) { - endps.push_back(new EndpointI(_instance, *p, _port, _timeout, _protocol, _encoding, _connectionId, - _compress)); + endps.push_back(new EndpointI(_instance, *p, _port, _timeout, _connectionId, _compress)); } } return endps; @@ -452,16 +425,6 @@ IceSSL::EndpointI::operator==(const Ice::LocalObject& r) const return true; } - if(_protocol != p->_protocol) - { - return false; - } - - if(_encoding != p->_encoding) - { - return false; - } - if(_host != p->_host) { return false; @@ -509,24 +472,6 @@ IceSSL::EndpointI::operator<(const Ice::LocalObject& r) const return false; } - if(_protocol < p->_protocol) - { - return true; - } - else if(p->_protocol < _protocol) - { - return false; - } - - if(_encoding < p->_encoding) - { - return true; - } - else if(p->_encoding < _encoding) - { - return false; - } - if(_host < p->_host) { return true; @@ -583,10 +528,6 @@ IceSSL::EndpointI::hashInit() const IceInternal::hashAdd(h, _host); IceInternal::hashAdd(h, _port); IceInternal::hashAdd(h, _timeout); - IceInternal::hashAdd(h, _protocol.major); - IceInternal::hashAdd(h, _protocol.minor); - IceInternal::hashAdd(h, _encoding.major); - IceInternal::hashAdd(h, _encoding.minor); IceInternal::hashAdd(h, _connectionId); IceInternal::hashAdd(h, _compress); return h; @@ -598,8 +539,7 @@ IceSSL::EndpointI::connectors(const vector<struct sockaddr_storage>& addresses) vector<IceInternal::ConnectorPtr> connectors; for(unsigned int i = 0; i < addresses.size(); ++i) { - connectors.push_back(new ConnectorI(_instance, _host, addresses[i], _timeout, _protocol, _encoding, - _connectionId)); + connectors.push_back(new ConnectorI(_instance, _host, addresses[i], _timeout, _connectionId)); } return connectors; } diff --git a/cpp/src/IceSSL/EndpointI.h b/cpp/src/IceSSL/EndpointI.h index 4eec180dfa8..14787ae1b0a 100644 --- a/cpp/src/IceSSL/EndpointI.h +++ b/cpp/src/IceSSL/EndpointI.h @@ -22,8 +22,7 @@ class EndpointI : public IceInternal::EndpointI { public: - EndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const Ice::ProtocolVersion&, - const Ice::EncodingVersion&, const std::string&, bool); + EndpointI(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&, bool); EndpointI(const InstancePtr&, const std::string&, bool); EndpointI(const InstancePtr&, IceInternal::BasicStream*); diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp index b7527f182fb..8640bc0d291 100644 --- a/cpp/test/Ice/info/AllTests.cpp +++ b/cpp/test/Ice/info/AllTests.cpp @@ -20,7 +20,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { cout << "testing proxy endpoint information... " << flush; { - Ice::ObjectPrx p1 = communicator->stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + Ice::ObjectPrx p1 = communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" "udp -h udphost -p 10001 --interface eth0 --ttl 5:" "opaque -e 1.8 -t 100 -v ABCD"); @@ -28,14 +28,6 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endps[0]->getInfo()); test(ipEndpoint); - Ice::ProtocolVersion pv; - pv.major = 1; - pv.minor = 4; - test(ipEndpoint->protocol == pv); - Ice::EncodingVersion ev; - ev.major = 1; - ev.minor = 3; - test(ipEndpoint->encoding == ev); test(ipEndpoint->host == "tcphost"); test(ipEndpoint->port == 10000); test(ipEndpoint->timeout == 1200); @@ -48,8 +40,6 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endps[1]->getInfo()); test(udpEndpoint); - test(udpEndpoint->protocol == Ice::currentProtocol); - test(udpEndpoint->encoding == Ice::currentEncoding); test(udpEndpoint->host == "udphost"); test(udpEndpoint->port == 10001); test(udpEndpoint->mcastInterface == "eth0"); diff --git a/cpp/test/Ice/info/TestI.cpp b/cpp/test/Ice/info/TestI.cpp index 306b6493690..183d39018f9 100644 --- a/cpp/test/Ice/info/TestI.cpp +++ b/cpp/test/Ice/info/TestI.cpp @@ -48,10 +48,6 @@ TestI::getEndpointInfoAsContext(const Ice::Current& c) if(Ice::UDPEndpointInfoPtr::dynamicCast(ipinfo)) { Ice::UDPEndpointInfoPtr udp = Ice::UDPEndpointInfoPtr::dynamicCast(ipinfo); - ctx["protocolMajor"] = udp->protocol.major; - ctx["protocolMinor"] = udp->protocol.minor; - ctx["encodingMajor"] = udp->encoding.major; - ctx["encodingMinor"] = udp->encoding.minor; ctx["mcastInterface"] = udp->mcastInterface; ctx["mcastTtl"] = udp->mcastTtl; } diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index 1c6a73461d2..53751798b20 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -577,6 +577,19 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref) hello->sayHello(); cout << "ok" << endl; + cout << "testing locator encoding resolution... " << flush; + + hello = HelloPrx::checkedCast(communicator->stringToProxy("hello")); + count = locator->getRequestCount(); + communicator->stringToProxy("test@TestAdapter")->ice_encodingVersion(Ice::Encoding_1_1)->ice_ping(); + test(count == locator->getRequestCount()); + communicator->stringToProxy("test@TestAdapter10")->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); + test(++count == locator->getRequestCount()); + communicator->stringToProxy("test -e 1.0@TestAdapter10-2")->ice_ping(); + test(++count == locator->getRequestCount()); + + cout << "ok" << endl; + cout << "shutdown server... " << flush; obj->shutdown(); cout << "ok" << endl; diff --git a/cpp/test/Ice/location/ServerLocator.cpp b/cpp/test/Ice/location/ServerLocator.cpp index 75f403e83fc..efb4e9b71b7 100644 --- a/cpp/test/Ice/location/ServerLocator.cpp +++ b/cpp/test/Ice/location/ServerLocator.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <Ice/BuiltinSequences.h> +#include <TestCommon.h> #include <ServerLocator.h> using namespace std; @@ -117,6 +118,13 @@ ServerLocator::findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& const Ice::Current& current) const { ++const_cast<int&>(_requestCount); + if(id == "TestAdapter10" || id == "TestAdapter10-2") + { + test(current.encoding == Ice::Encoding_1_0); + response->ice_response(_registry->getAdapter("TestAdapter")); + return; + } + // We add a small delay to make sure locator request queuing gets tested when // running the test on a fast machine IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 215dab04312..3c1bfa42822 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -488,7 +488,8 @@ allTests(const Ice::CommunicatorPtr& communicator) cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]); sm2 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); - test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4); // 4 is for the seq variable size + // 4 is for the seq variable size + test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4); test(cm2->receivedBytes - cm1->receivedBytes == replySz); test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4); if(sm2->sentBytes - sm1->sentBytes != replySz) @@ -498,7 +499,8 @@ allTests(const Ice::CommunicatorPtr& communicator) // to the operation is sent and getMetricsView can be dispatched before the metric is really // updated. IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100)); - sm2 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); + sm2 = IceMX::ConnectionMetricsPtr::dynamicCast( + serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); } test(sm2->sentBytes - sm1->sentBytes == replySz); @@ -511,7 +513,8 @@ allTests(const Ice::CommunicatorPtr& communicator) cm2 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]); sm2 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); - test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4); // 4 is for the seq variable size + // 4 is for the seq variable size + test(cm2->sentBytes - cm1->sentBytes == requestSz + static_cast<int>(bs.size()) + 4); test(cm2->receivedBytes - cm1->receivedBytes == replySz); test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4); if(sm2->sentBytes - sm1->sentBytes != replySz) @@ -521,7 +524,8 @@ allTests(const Ice::CommunicatorPtr& communicator) // to the operation is sent and getMetricsView can be dispatched before the metric is really // updated. IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100)); - sm2 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); + sm2 = IceMX::ConnectionMetricsPtr::dynamicCast( + serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); } test(sm2->sentBytes - sm1->sentBytes == replySz); @@ -574,7 +578,8 @@ allTests(const Ice::CommunicatorPtr& communicator) cm1 = IceMX::ConnectionMetricsPtr::dynamicCast(clientMetrics->getMetricsView("View", timestamp)["Connection"][0]); while(true) { - sm1 = IceMX::ConnectionMetricsPtr::dynamicCast(serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); + sm1 = IceMX::ConnectionMetricsPtr::dynamicCast( + serverMetrics->getMetricsView("View", timestamp)["Connection"][0]); if(sm1-> failures >= 2) { break; @@ -593,14 +598,11 @@ allTests(const Ice::CommunicatorPtr& communicator) testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator"); //testAttribute(clientMetrics, clientProps, update, "Connection", "id", ""); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 500"); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", "tcp -h 127.0.0.1 -p 12010 -t 500"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointProtocolVersion", "1.0"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointEncodingVersion", "1.1"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1"); @@ -660,13 +662,11 @@ allTests(const Ice::CommunicatorPtr& communicator) 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 -e 1.1 -h 127.0.0.1 -p 12010", c); + "tcp -h 127.0.0.1 -p 12010", 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", "endpointProtocolVersion", "1.0", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointEncodingVersion", "1.1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c); @@ -691,7 +691,7 @@ allTests(const Ice::CommunicatorPtr& communicator) 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 -e 1.1 -h localhost -p 12010"); + test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010"); prx->ice_getConnection()->close(false); @@ -709,22 +709,20 @@ allTests(const Ice::CommunicatorPtr& communicator) } test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1]; - test(m1->id == "tcp -e 1.1 -h unknownfoo.zeroc.com -p 12010" && m1->total == 2 && m1->failures == 2); + test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010" && m1->total == 2 && m1->failures == 2); checkFailure(clientMetrics, "EndpointLookup", m1->id, "Ice::DNSException", 2); c = Connect(prx); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -e 1.1 -h localhost -p 12010", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", - "tcp -e 1.1 -h localhost -p 12010", c); + "tcp -h localhost -p 12010", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointProtocolVersion", "1.0", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointEncodingVersion", "1.1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c); @@ -806,14 +804,12 @@ allTests(const Ice::CommunicatorPtr& communicator) testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -e 1.1 -h 127.0.0.1 -p 12010", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010", 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", "endpointProtocolVersion", "1.0", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointEncodingVersion", "1.1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op); @@ -997,7 +993,7 @@ allTests(const Ice::CommunicatorPtr& communicator) testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "id", - "metrics -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 [op]", op); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 [op]", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "operation", "op", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "identity", "metrics", op); @@ -1005,7 +1001,7 @@ allTests(const Ice::CommunicatorPtr& communicator) 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:tcp -e 1.1 -h 127.0.0.1 -p 12010", op); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010", 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 4773088850d..9f6428f111b 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -212,6 +212,14 @@ allTests(const Ice::CommunicatorPtr& communicator) b1 = communicator->stringToProxy("test -s"); test(b1->ice_isSecure()); + test(b1->ice_getEncodingVersion() == Ice::currentEncoding); + + b1 = communicator->stringToProxy("test -e 1.0"); + test(b1->ice_getEncodingVersion().major == 1 && b1->ice_getEncodingVersion().minor == 0); + + b1 = communicator->stringToProxy("test -e 6.5"); + test(b1->ice_getEncodingVersion().major == 6 && b1->ice_getEncodingVersion().minor == 5); + try { b1 = communicator->stringToProxy("test:tcp@adapterId"); @@ -327,31 +335,6 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!b1->ice_isCollocationOptimized()); prop->setProperty(property, ""); - property = propertyPrefix + ".EncodingVersion"; - test(b1->ice_getEncodingVersion() == Ice::currentEncoding); - prop->setProperty(property, "1.0"); - b1 = communicator->propertyToProxy(propertyPrefix); - test(b1->ice_getEncodingVersion().major == 1 && b1->ice_getEncodingVersion().minor == 0); - prop->setProperty(property, "6.5"); - try - { - communicator->propertyToProxy(propertyPrefix); - test(false); - } - catch(const Ice::UnsupportedEncodingException&) - { - } - prop->setProperty(property, "1.2"); - try - { - communicator->propertyToProxy(propertyPrefix); - test(false); - } - catch(const Ice::UnsupportedEncodingException&) - { - } - prop->setProperty(property, ""); - cout << "ok" << endl; cout << "testing proxyToProperty... " << flush; @@ -382,42 +365,29 @@ allTests(const Ice::CommunicatorPtr& communicator) b1 = b1->ice_locator(Ice::LocatorPrx::uncheckedCast(locator)); Ice::PropertyDict proxyProps = communicator->proxyToProperty(b1, "Test"); - test(proxyProps.size() == 21); + test(proxyProps.size() == 18); test(proxyProps["Test"] == "test -t"); - test(proxyProps["Test.EncodingVersion"] == "1.0"); test(proxyProps["Test.CollocationOptimized"] == "1"); test(proxyProps["Test.ConnectionCached"] == "1"); test(proxyProps["Test.PreferSecure"] == "0"); test(proxyProps["Test.EndpointSelection"] == "Ordered"); test(proxyProps["Test.LocatorCacheTimeout"] == "100"); - test(proxyProps["Test.Locator"] == "locator -t"); - test(proxyProps["Test.Locator.EncodingVersion"] == Ice::encodingVersionToString(Ice::currentEncoding)); + test(proxyProps["Test.Locator"] == "locator -t -e " + Ice::encodingVersionToString(Ice::currentEncoding)); test(proxyProps["Test.Locator.CollocationOptimized"] == "1"); test(proxyProps["Test.Locator.ConnectionCached"] == "0"); test(proxyProps["Test.Locator.PreferSecure"] == "1"); test(proxyProps["Test.Locator.EndpointSelection"] == "Random"); test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300"); - test(proxyProps["Test.Locator.Router"] == "router -t"); - test(proxyProps["Test.Locator.Router.EncodingVersion"] == Ice::encodingVersionToString(Ice::currentEncoding)); + test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice::encodingVersionToString(Ice::currentEncoding)); test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0"); test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1"); test(proxyProps["Test.Locator.Router.PreferSecure"] == "1"); test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random"); test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200"); - try - { - Ice::EncodingVersion v = { 3, 4 }; - b1->ice_encodingVersion(v); - test(false); - } - catch(const Ice::UnsupportedEncodingException&) - { - } - cout << "ok" << endl; cout << "testing ice_getCommunicator... " << flush; @@ -653,35 +623,74 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; + cout << "testing protocol versioning... " << flush; + { + Ice::OutputStreamPtr out = Ice::createOutputStream(communicator); + out->write(cl); + vector<Ice::Byte> inBytes; + out->finished(inBytes); + + // Protocol version 1.1 + inBytes[9] = 1; + inBytes[10] = 1; + + Ice::InputStreamPtr in = Ice::createInputStream(communicator, inBytes); + Test::MyClassPrx cl11; + in->read(cl11); + cl11 = cl11->ice_collocationOptimized(false); + test(cl11->ice_toString() == "test -t -p 1.1 -e 1.1:tcp -h 127.0.0.1 -p 12010"); + try + { + cl11->ice_ping(); + test(false); + } + catch(const Ice::UnsupportedProtocolException&) + { + } + try + { + cl11->end_ice_ping(cl11->begin_ice_ping()); + test(false); + } + catch(const Ice::UnsupportedProtocolException&) + { + } + try + { + cl11->ice_flushBatchRequests(); + test(false); + } + catch(const Ice::UnsupportedProtocolException&) + { + } + try + { + cl11->end_ice_flushBatchRequests(cl11->begin_ice_flushBatchRequests()); + test(false); + } + catch(const Ice::UnsupportedProtocolException&) + { + } + } + cout << "ok" << endl; + cout << "testing encoding versioning... " << flush; - string ref20 = "test:default -p 12010 -e 2.0"; + string ref20 = "test -e 2.0:default -p 12010"; Test::MyClassPrx cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); try { cl20->ice_collocationOptimized(false)->ice_ping(); test(false); } - catch(const Ice::NoEndpointException&) + catch(const Ice::UnsupportedEncodingException&) { // Server 2.0 endpoint doesn't support 1.1 version. } - string ref10 = "test:default -p 12010 -e 1.0"; + string ref10 = "test -e 1.0:default -p 12010"; Test::MyClassPrx cl10 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref10)); - try - { - cl10->ice_collocationOptimized(false)->ice_ping(); // Can't send request with 1.1 encoding on 1.0 endpoint. - test(false); - } - catch(const Ice::NoEndpointException&) - { - // Server 1.0 endpoint doesn't support 1.1 version. - } - - // Server with 1.0 endpoint supports 1.0 encoding. + cl10->ice_ping(); cl10->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); - - // Server with 1.1 endpoint supports 1.0 encoding. cl->ice_collocationOptimized(false)->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); try @@ -841,17 +850,13 @@ allTests(const Ice::CommunicatorPtr& communicator) } // Legal TCP endpoint expressed as opaque endpoint - Ice::ObjectPrx p1 = communicator->stringToProxy("test:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + Ice::ObjectPrx p1 = communicator->stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); string pstr = communicator->proxyToString(p1); - test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); - - // 1.1 TCP endpoint encoded with 1.1 encoding. - Ice::ObjectPrx p2 = communicator->stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE="); - test(communicator->proxyToString(p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000"); + test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); - // 1.0 TCP endpoint encoded with 1.1 encoding. - p2 = communicator->stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA="); - test(communicator->proxyToString(p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); + // Opaque endpoint encoded with 1.1 encoding. + Ice::ObjectPrx p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0) { @@ -867,7 +872,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } // Two legal TCP endpoints expressed as opaque endpoints - p1 = communicator->stringToProxy("test:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); + p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); pstr = communicator->proxyToString(p1); test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"); @@ -875,7 +880,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // Test that an SSL endpoint and a nonsense endpoint get written // back out as an opaque endpoint. // - p1 = communicator->stringToProxy("test:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch"); + p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch"); pstr = communicator->proxyToString(p1); if(!ssl) { diff --git a/cs/src/Ice/EndpointI.cs b/cs/src/Ice/EndpointI.cs index cac498b9948..9d802dbce1a 100644 --- a/cs/src/Ice/EndpointI.cs +++ b/cs/src/Ice/EndpointI.cs @@ -23,17 +23,13 @@ namespace IceInternal public abstract class EndpointI : Ice.Endpoint, System.IComparable<EndpointI> { - public EndpointI(Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, string connectionId) + public EndpointI(string connectionId) { - protocol_ = protocol; - encoding_ = encoding; connectionId_ = connectionId; } public EndpointI() { - protocol_ = Ice.Util.currentProtocol; - encoding_ = Ice.Util.currentEncoding; } public override string ToString() @@ -56,50 +52,12 @@ namespace IceInternal public override int GetHashCode() { int h = 5381; - IceInternal.HashUtil.hashAdd(ref h, protocol_); - IceInternal.HashUtil.hashAdd(ref h, encoding_); IceInternal.HashUtil.hashAdd(ref h, connectionId_); return h; } public virtual int CompareTo(EndpointI p) { - if(protocol_.major < p.protocol_.major) - { - return -1; - } - else if(p.protocol_.major < protocol_.major) - { - return 1; - } - - if(protocol_.minor < p.protocol_.minor) - { - return -1; - } - else if(p.protocol_.minor < protocol_.minor) - { - return 1; - } - - if(encoding_.major < p.encoding_.major) - { - return -1; - } - else if(p.encoding_.major < encoding_.major) - { - return 1; - } - - if(encoding_.minor < p.encoding_.minor) - { - return -1; - } - else if(p.encoding_.minor < encoding_.minor) - { - return 1; - } - if(!connectionId_.Equals(p.connectionId_)) { return string.Compare(connectionId_, p.connectionId_, StringComparison.Ordinal); @@ -165,22 +123,6 @@ namespace IceInternal public abstract bool secure(); // - // Return the protocol supported by the endpoint. - // - public Ice.ProtocolVersion protocolVersion() - { - return protocol_; - } - - // - // Return the encoding supported by the endpoint. - // - public Ice.EncodingVersion encodingVersion() - { - return encoding_; - } - - // // Return the connection ID. // public string connectionId() diff --git a/cs/src/Ice/InstrumentationI.cs b/cs/src/Ice/InstrumentationI.cs index 1ca9f8ed16a..735f8f2b50c 100644 --- a/cs/src/Ice/InstrumentationI.cs +++ b/cs/src/Ice/InstrumentationI.cs @@ -27,8 +27,6 @@ namespace IceInternal r.add("endpointType", cl.GetMethod("getEndpointInfo"), cli.GetMethod("type")); r.add("endpointIsDatagram", cl.GetMethod("getEndpointInfo"), cli.GetMethod("datagram")); r.add("endpointIsSecure", cl.GetMethod("getEndpointInfo"), cli.GetMethod("secure")); - r.add("endpointProtocolVersion", cl.GetMethod("getEndpointProtocolVersion")); - r.add("endpointEncodingVersion", cl.GetMethod("getEndpointEncodingVersion")); r.add("endpointTimeout", cl.GetMethod("getEndpointInfo"), cli.GetField("timeout")); r.add("endpointCompress", cl.GetMethod("getEndpointInfo"), cli.GetField("compress")); @@ -165,16 +163,6 @@ namespace IceInternal return _endpointInfo; } - public string getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - - public string getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - readonly private Ice.ConnectionInfo _connectionInfo; readonly private Ice.Endpoint _endpoint; readonly private Ice.Instrumentation.ConnectionState _state; @@ -277,16 +265,6 @@ namespace IceInternal return _endpointInfo; } - public string getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - - public string getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - public Ice.Current getCurrent() { return _current; @@ -539,16 +517,6 @@ namespace IceInternal return _endpointInfo; } - public string getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - - public string getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - public string getParent() { return "Communicator"; @@ -644,16 +612,6 @@ namespace IceInternal return _endpointInfo; } - public string getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - - public string getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - readonly private Ice.ConnectionInfo _connectionInfo; readonly private Ice.Endpoint _endpoint; private string _id; diff --git a/cs/src/Ice/LocatorInfo.cs b/cs/src/Ice/LocatorInfo.cs index dcb3cb612b5..7788d9ae446 100644 --- a/cs/src/Ice/LocatorInfo.cs +++ b/cs/src/Ice/LocatorInfo.cs @@ -781,10 +781,45 @@ namespace IceInternal public sealed class LocatorManager { + struct LocatorKey + { + public LocatorKey(Ice.LocatorPrx prx) + { + Reference r = ((Ice.ObjectPrxHelperBase)prx).reference__(); + _id = r.getIdentity(); + _encoding = r.getEncoding(); + } + + public override bool Equals(object o) + { + LocatorKey k = (LocatorKey)o; + if(!k._id.Equals(_id)) + { + return false; + } + if(!k._encoding.Equals(_encoding)) + { + return false; + } + return true; + } + + public override int GetHashCode() + { + int h = 5381; + IceInternal.HashUtil.hashAdd(ref h, _id); + IceInternal.HashUtil.hashAdd(ref h, _encoding); + return h; + } + + private Ice.Identity _id; + private Ice.EncodingVersion _encoding; + }; + internal LocatorManager(Ice.Properties properties) { _table = new Dictionary<Ice.LocatorPrx, LocatorInfo>(); - _locatorTables = new Dictionary<Ice.Identity, LocatorTable>(); + _locatorTables = new Dictionary<LocatorKey, LocatorTable>(); _background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0; } @@ -832,10 +867,11 @@ namespace IceInternal // proxy). // LocatorTable table = null; - if(!_locatorTables.TryGetValue(locator.ice_getIdentity(), out table)) + LocatorKey key = new LocatorKey(locator); + if(!_locatorTables.TryGetValue(key, out table)) { table = new LocatorTable(); - _locatorTables[locator.ice_getIdentity()] = table; + _locatorTables[key] = table; } info = new LocatorInfo(locator, table, _background); @@ -847,7 +883,7 @@ namespace IceInternal } private Dictionary<Ice.LocatorPrx, LocatorInfo> _table; - private Dictionary<Ice.Identity, LocatorTable> _locatorTables; + private Dictionary<LocatorKey, LocatorTable> _locatorTables; private readonly bool _background; } diff --git a/cs/src/Ice/OpaqueEndpointI.cs b/cs/src/Ice/OpaqueEndpointI.cs index 34b11774a1b..3191d28972b 100644 --- a/cs/src/Ice/OpaqueEndpointI.cs +++ b/cs/src/Ice/OpaqueEndpointI.cs @@ -16,7 +16,7 @@ namespace IceInternal sealed class OpaqueEndpointI : EndpointI { - public OpaqueEndpointI(string str) : base(new Ice.ProtocolVersion(0, 0), new Ice.EncodingVersion(0, 0), "") + public OpaqueEndpointI(string str) : base("") { int topt = 0; int vopt = 0; @@ -182,7 +182,7 @@ namespace IceInternal private sealed class InfoI : Ice.OpaqueEndpointInfo { public InfoI(short type, Ice.EncodingVersion rawEncoding, byte[] rawBytes) : - base(Ice.Util.currentProtocol, Ice.Util.currentEncoding, -1, false, rawEncoding, rawBytes) + base(-1, false, rawEncoding, rawBytes) { _type = type; } diff --git a/cs/src/Ice/Outgoing.cs b/cs/src/Ice/Outgoing.cs index 9626adb63a5..3a46556ed68 100644 --- a/cs/src/Ice/Outgoing.cs +++ b/cs/src/Ice/Outgoing.cs @@ -33,6 +33,8 @@ namespace IceInternal _encoding = handler.getReference().getEncoding(); _os = new BasicStream(_handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding); + Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); + writeHeader(operation, mode, context); } @@ -49,6 +51,8 @@ namespace IceInternal _observer = observer; _encoding = handler.getReference().getEncoding(); + Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); + writeHeader(operation, mode, context); } @@ -657,6 +661,7 @@ namespace IceInternal _sent = false; _observer = observer; _os = new BasicStream(handler.getReference().getInstance(), Ice.Util.currentProtocolEncoding); + Protocol.checkSupportedProtocol(handler.getReference().getProtocol()); } public void invoke() diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index 80d5dacbe09..05847b51803 100644 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -809,6 +809,8 @@ namespace IceInternal _mode = mode; sentSynchronously_ = false; + Protocol.checkSupportedProtocol(proxy_.reference__().getProtocol()); + if(explicitContext && context == null) { context = emptyContext_; @@ -1587,12 +1589,14 @@ namespace IceInternal base(proxy.ice_getCommunicator(), ((Ice.ObjectPrxHelperBase)proxy).reference__().getInstance(), operation, cookie) { - _proxy = proxy; + _proxy = (Ice.ObjectPrxHelperBase)proxy; observer_ = ObserverHelper.get(proxy, operation); } public void send__() { + Protocol.checkSupportedProtocol(_proxy.reference__().getProtocol()); + // // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch // requests were queued with the connection, they would be lost without being noticed. @@ -1601,7 +1605,7 @@ namespace IceInternal int cnt = -1; // Don't retry. try { - @delegate = ((Ice.ObjectPrxHelperBase)_proxy).getDelegate__(false); + @delegate = _proxy.getDelegate__(false); Ice.AsyncCallback sentCallback; if(@delegate.getRequestHandler__().flushAsyncBatchRequests(this, out sentCallback)) { @@ -1614,7 +1618,7 @@ namespace IceInternal } catch(Ice.LocalException __ex) { - ((Ice.ObjectPrxHelperBase)_proxy).handleException__(@delegate, __ex, false, ref cnt, observer_); + _proxy.handleException__(@delegate, __ex, false, ref cnt, observer_); } } @@ -1623,7 +1627,7 @@ namespace IceInternal return _proxy; } - private Ice.ObjectPrx _proxy; + private Ice.ObjectPrxHelperBase _proxy; } public class ConnectionBatchOutgoingAsync : BatchOutgoingAsync diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs index 7b804e236a1..98d93af3a0d 100644 --- a/cs/src/Ice/PropertyNames.cs +++ b/cs/src/Ice/PropertyNames.cs @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Oct 22 18:48:40 2012 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Nov 12 21:17:34 2012 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -29,7 +29,6 @@ namespace IceInternal new Property(@"^Ice\.Admin\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^Ice\.Admin\.Locator\.Locator$", false, null), new Property(@"^Ice\.Admin\.Locator\.Router$", false, null), - new Property(@"^Ice\.Admin\.Locator\.EncodingVersion$", false, null), new Property(@"^Ice\.Admin\.Locator\.CollocationOptimized$", false, null), new Property(@"^Ice\.Admin\.Locator$", false, null), new Property(@"^Ice\.Admin\.PublishedEndpoints$", false, null), @@ -40,7 +39,6 @@ namespace IceInternal new Property(@"^Ice\.Admin\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^Ice\.Admin\.Router\.Locator$", false, null), new Property(@"^Ice\.Admin\.Router\.Router$", false, null), - new Property(@"^Ice\.Admin\.Router\.EncodingVersion$", false, null), new Property(@"^Ice\.Admin\.Router\.CollocationOptimized$", false, null), new Property(@"^Ice\.Admin\.Router$", false, null), new Property(@"^Ice\.Admin\.ProxyOptions$", false, null), @@ -71,7 +69,6 @@ namespace IceInternal new Property(@"^Ice\.Default\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^Ice\.Default\.Locator\.Locator$", false, null), new Property(@"^Ice\.Default\.Locator\.Router$", false, null), - new Property(@"^Ice\.Default\.Locator\.EncodingVersion$", false, null), new Property(@"^Ice\.Default\.Locator\.CollocationOptimized$", false, null), new Property(@"^Ice\.Default\.Locator$", false, null), new Property(@"^Ice\.Default\.LocatorCacheTimeout$", false, null), @@ -84,7 +81,6 @@ namespace IceInternal new Property(@"^Ice\.Default\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^Ice\.Default\.Router\.Locator$", false, null), new Property(@"^Ice\.Default\.Router\.Router$", false, null), - new Property(@"^Ice\.Default\.Router\.EncodingVersion$", false, null), new Property(@"^Ice\.Default\.Router\.CollocationOptimized$", false, null), new Property(@"^Ice\.Default\.Router$", false, null), new Property(@"^Ice\.Default\.SlicedFormat$", false, null), @@ -184,7 +180,6 @@ namespace IceInternal new Property(@"^IceBox\.ServiceManager\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceBox\.ServiceManager\.Locator\.Locator$", false, null), new Property(@"^IceBox\.ServiceManager\.Locator\.Router$", false, null), - new Property(@"^IceBox\.ServiceManager\.Locator\.EncodingVersion$", false, null), new Property(@"^IceBox\.ServiceManager\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceBox\.ServiceManager\.Locator$", false, null), new Property(@"^IceBox\.ServiceManager\.PublishedEndpoints$", false, null), @@ -195,7 +190,6 @@ namespace IceInternal new Property(@"^IceBox\.ServiceManager\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceBox\.ServiceManager\.Router\.Locator$", false, null), new Property(@"^IceBox\.ServiceManager\.Router\.Router$", false, null), - new Property(@"^IceBox\.ServiceManager\.Router\.EncodingVersion$", false, null), new Property(@"^IceBox\.ServiceManager\.Router\.CollocationOptimized$", false, null), new Property(@"^IceBox\.ServiceManager\.Router$", false, null), new Property(@"^IceBox\.ServiceManager\.ProxyOptions$", false, null), @@ -219,7 +213,6 @@ namespace IceInternal new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy\.LocatorCacheTimeout$", false, null), new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy\.Locator$", false, null), new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy\.Router$", false, null), - new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy\.EncodingVersion$", false, null), new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy\.CollocationOptimized$", false, null), new Property(@"^IceBoxAdmin\.ServiceManager\.Proxy$", false, null), null @@ -248,7 +241,6 @@ namespace IceInternal new Property(@"^IceGrid\.Node\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Node\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Node\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Node\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Node\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Node\.Locator$", false, null), new Property(@"^IceGrid\.Node\.PublishedEndpoints$", false, null), @@ -259,7 +251,6 @@ namespace IceInternal new Property(@"^IceGrid\.Node\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Node\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Node\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Node\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Node\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Node\.Router$", false, null), new Property(@"^IceGrid\.Node\.ProxyOptions$", false, null), @@ -293,7 +284,6 @@ namespace IceInternal new Property(@"^IceGrid\.Node\.UserAccountMapper\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Node\.UserAccountMapper\.Locator$", false, null), new Property(@"^IceGrid\.Node\.UserAccountMapper\.Router$", false, null), - new Property(@"^IceGrid\.Node\.UserAccountMapper\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Node\.UserAccountMapper\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Node\.UserAccountMapper$", false, null), new Property(@"^IceGrid\.Node\.WaitTime$", false, null), @@ -304,7 +294,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.AdminPermissionsVerifier$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionFilters$", false, null), @@ -317,7 +306,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.PublishedEndpoints$", false, null), @@ -328,7 +316,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.Router$", false, null), new Property(@"^IceGrid\.Registry\.AdminSessionManager\.ProxyOptions$", false, null), @@ -345,7 +332,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.AdminSSLPermissionsVerifier$", false, null), new Property(@"^IceGrid\.Registry\.Client\.ACM$", false, null), @@ -357,7 +343,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Client\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Client\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Client\.PublishedEndpoints$", false, null), @@ -368,7 +353,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Client\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Client\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Client\.Router$", false, null), new Property(@"^IceGrid\.Registry\.Client\.ProxyOptions$", false, null), @@ -392,7 +376,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Internal\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Internal\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.PublishedEndpoints$", false, null), @@ -403,7 +386,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Internal\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Internal\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.Router$", false, null), new Property(@"^IceGrid\.Registry\.Internal\.ProxyOptions$", false, null), @@ -421,7 +403,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.PermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.PermissionsVerifier\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.PermissionsVerifier\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.PermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.PermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.PermissionsVerifier$", false, null), new Property(@"^IceGrid\.Registry\.ReplicaName$", false, null), @@ -437,7 +418,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Server\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Server\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Server\.PublishedEndpoints$", false, null), @@ -448,7 +428,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Server\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.Server\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.Server\.Router$", false, null), new Property(@"^IceGrid\.Registry\.Server\.ProxyOptions$", false, null), @@ -469,7 +448,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.SessionManager\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Locator\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Locator\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.SessionManager\.Locator\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Locator\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.PublishedEndpoints$", false, null), @@ -480,7 +458,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.SessionManager\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Router\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Router\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.SessionManager\.Router\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Router\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.Router$", false, null), new Property(@"^IceGrid\.Registry\.SessionManager\.ProxyOptions$", false, null), @@ -498,7 +475,6 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.Router$", false, null), - new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^IceGrid\.Registry\.SSLPermissionsVerifier$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Application$", false, null), @@ -535,7 +511,6 @@ namespace IceInternal new Property(@"^IcePatch2\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^IcePatch2\.Locator\.Locator$", false, null), new Property(@"^IcePatch2\.Locator\.Router$", false, null), - new Property(@"^IcePatch2\.Locator\.EncodingVersion$", false, null), new Property(@"^IcePatch2\.Locator\.CollocationOptimized$", false, null), new Property(@"^IcePatch2\.Locator$", false, null), new Property(@"^IcePatch2\.PublishedEndpoints$", false, null), @@ -546,7 +521,6 @@ namespace IceInternal new Property(@"^IcePatch2\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^IcePatch2\.Router\.Locator$", false, null), new Property(@"^IcePatch2\.Router\.Router$", false, null), - new Property(@"^IcePatch2\.Router\.EncodingVersion$", false, null), new Property(@"^IcePatch2\.Router\.CollocationOptimized$", false, null), new Property(@"^IcePatch2\.Router$", false, null), new Property(@"^IcePatch2\.ProxyOptions$", false, null), @@ -630,7 +604,6 @@ namespace IceInternal new Property(@"^Glacier2\.Client\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.Client\.Locator\.Locator$", false, null), new Property(@"^Glacier2\.Client\.Locator\.Router$", false, null), - new Property(@"^Glacier2\.Client\.Locator\.EncodingVersion$", false, null), new Property(@"^Glacier2\.Client\.Locator\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.Client\.Locator$", false, null), new Property(@"^Glacier2\.Client\.PublishedEndpoints$", false, null), @@ -641,7 +614,6 @@ namespace IceInternal new Property(@"^Glacier2\.Client\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.Client\.Router\.Locator$", false, null), new Property(@"^Glacier2\.Client\.Router\.Router$", false, null), - new Property(@"^Glacier2\.Client\.Router\.EncodingVersion$", false, null), new Property(@"^Glacier2\.Client\.Router\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.Client\.Router$", false, null), new Property(@"^Glacier2\.Client\.ProxyOptions$", false, null), @@ -674,7 +646,6 @@ namespace IceInternal new Property(@"^Glacier2\.PermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.PermissionsVerifier\.Locator$", false, null), new Property(@"^Glacier2\.PermissionsVerifier\.Router$", false, null), - new Property(@"^Glacier2\.PermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^Glacier2\.PermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.PermissionsVerifier$", false, null), new Property(@"^Glacier2\.ReturnClientProxy$", false, null), @@ -684,7 +655,6 @@ namespace IceInternal new Property(@"^Glacier2\.SSLPermissionsVerifier\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.SSLPermissionsVerifier\.Locator$", false, null), new Property(@"^Glacier2\.SSLPermissionsVerifier\.Router$", false, null), - new Property(@"^Glacier2\.SSLPermissionsVerifier\.EncodingVersion$", false, null), new Property(@"^Glacier2\.SSLPermissionsVerifier\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.SSLPermissionsVerifier$", false, null), new Property(@"^Glacier2\.RoutingTable\.MaxSize$", false, null), @@ -697,7 +667,6 @@ namespace IceInternal new Property(@"^Glacier2\.Server\.Locator\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.Server\.Locator\.Locator$", false, null), new Property(@"^Glacier2\.Server\.Locator\.Router$", false, null), - new Property(@"^Glacier2\.Server\.Locator\.EncodingVersion$", false, null), new Property(@"^Glacier2\.Server\.Locator\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.Server\.Locator$", false, null), new Property(@"^Glacier2\.Server\.PublishedEndpoints$", false, null), @@ -708,7 +677,6 @@ namespace IceInternal new Property(@"^Glacier2\.Server\.Router\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.Server\.Router\.Locator$", false, null), new Property(@"^Glacier2\.Server\.Router\.Router$", false, null), - new Property(@"^Glacier2\.Server\.Router\.EncodingVersion$", false, null), new Property(@"^Glacier2\.Server\.Router\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.Server\.Router$", false, null), new Property(@"^Glacier2\.Server\.ProxyOptions$", false, null), @@ -731,7 +699,6 @@ namespace IceInternal new Property(@"^Glacier2\.SessionManager\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.SessionManager\.Locator$", false, null), new Property(@"^Glacier2\.SessionManager\.Router$", false, null), - new Property(@"^Glacier2\.SessionManager\.EncodingVersion$", false, null), new Property(@"^Glacier2\.SessionManager\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.SessionManager$", false, null), new Property(@"^Glacier2\.SSLSessionManager\.EndpointSelection$", false, null), @@ -740,7 +707,6 @@ namespace IceInternal new Property(@"^Glacier2\.SSLSessionManager\.LocatorCacheTimeout$", false, null), new Property(@"^Glacier2\.SSLSessionManager\.Locator$", false, null), new Property(@"^Glacier2\.SSLSessionManager\.Router$", false, null), - new Property(@"^Glacier2\.SSLSessionManager\.EncodingVersion$", false, null), new Property(@"^Glacier2\.SSLSessionManager\.CollocationOptimized$", false, null), new Property(@"^Glacier2\.SSLSessionManager$", false, null), new Property(@"^Glacier2\.SessionTimeout$", false, null), diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 047234911f1..ff72abe575c 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -1882,7 +1882,6 @@ namespace Ice } else { - IceInternal.Protocol.checkSupportedEncoding(e); return newInstance(_reference.changeEncoding(e)); } } diff --git a/cs/src/Ice/Reference.cs b/cs/src/Ice/Reference.cs index 81dbd4ce1da..b5a01dc91e1 100644 --- a/cs/src/Ice/Reference.cs +++ b/cs/src/Ice/Reference.cs @@ -43,12 +43,16 @@ namespace IceInternal return secure_; } + public Ice.ProtocolVersion getProtocol() + { + return protocol_; + } + public Ice.EncodingVersion getEncoding() { return encoding_; } - public Ice.Identity getIdentity() { return identity_; @@ -152,7 +156,7 @@ namespace IceInternal return r; } - public Reference changeEncoding(Ice.EncodingVersion newEncoding) + public virtual Reference changeEncoding(Ice.EncodingVersion newEncoding) { if(newEncoding.Equals(encoding_)) { @@ -208,6 +212,7 @@ namespace IceInternal { IceInternal.HashUtil.hashAdd(ref h, compress_); } + IceInternal.HashUtil.hashAdd(ref h, protocol_); IceInternal.HashUtil.hashAdd(ref h, encoding_); hashValue_ = h; hashInitialized_ = true; @@ -245,6 +250,12 @@ namespace IceInternal s.writeBool(secure_); + if(!s.getWriteEncoding().Equals(Ice.Util.Encoding_1_0)) + { + protocol_.write__(s); + encoding_.write__(s); + } + // Derived class writes the remainder of the reference. } @@ -338,6 +349,18 @@ namespace IceInternal s.Append(" -s"); } + if(!protocol_.Equals(Ice.Util.Protocol_1_0)) + { + s.Append(" -p "); + s.Append(Ice.Util.protocolVersionToString(protocol_)); + } + + if(!encoding_.Equals(Ice.Util.Encoding_1_0)) + { + s.Append(" -e "); + s.Append(Ice.Util.encodingVersionToString(encoding_)); + } + return s.ToString(); // Derived class writes the remainder of the string. @@ -390,6 +413,11 @@ namespace IceInternal return false; } + if(!protocol_.Equals(r.protocol_)) + { + return false; + } + if(!encoding_.Equals(r.encoding_)) { return false; @@ -418,6 +446,7 @@ namespace IceInternal private Dictionary<string, string> context_; private string facet_; protected bool secure_; + private Ice.ProtocolVersion protocol_; private Ice.EncodingVersion encoding_; protected bool overrideCompress_; protected bool compress_; // Only used if _overrideCompress == true @@ -428,6 +457,7 @@ namespace IceInternal string facet, Mode mode, bool secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding) { // @@ -443,6 +473,7 @@ namespace IceInternal identity_ = identity; context_ = _emptyContext; facet_ = facet; + protocol_ = protocol; encoding_ = encoding; secure_ = secure; hashInitialized_ = false; @@ -463,7 +494,7 @@ namespace IceInternal bool secure, Ice.EncodingVersion encoding, Ice.ConnectionI connection) - : base(instance, communicator, identity, facet, mode, secure, encoding) + : base(instance, communicator, identity, facet, mode, secure, Ice.Util.Protocol_1_0, encoding) { _fixedConnection = connection; } @@ -756,6 +787,21 @@ namespace IceInternal return _connectionId; } + public override Reference changeEncoding(Ice.EncodingVersion newEncoding) + { + RoutableReference r = (RoutableReference)base.changeEncoding(newEncoding); + if(r != this) + { + LocatorInfo locInfo = r._locatorInfo; + if(locInfo != null && !locInfo.getLocator().ice_getEncodingVersion().Equals(newEncoding)) + { + r._locatorInfo = getInstance().locatorManager().get( + (Ice.LocatorPrx)locInfo.getLocator().ice_encodingVersion(newEncoding)); + } + } + return r; + } + public override Reference changeCompress(bool newCompress) { RoutableReference r = (RoutableReference)base.changeCompress(newCompress); @@ -1004,7 +1050,6 @@ namespace IceInternal properties[prefix + ".PreferSecure"] = _preferSecure ? "1" : "0"; properties[prefix + ".EndpointSelection"] = _endpointSelection == Ice.EndpointSelectionType.Random ? "Random" : "Ordered"; - properties[prefix + ".EncodingVersion"] = Ice.Util.encodingVersionToString(getEncoding()); properties[prefix + ".LocatorCacheTimeout"] = _locatorCacheTimeout.ToString(CultureInfo.InvariantCulture); if(_routerInfo != null) @@ -1328,6 +1373,7 @@ namespace IceInternal string facet, Reference.Mode mode, bool secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, EndpointI[] endpoints, string adapterId, @@ -1338,7 +1384,7 @@ namespace IceInternal bool preferSecure, Ice.EndpointSelectionType endpointSelection, int locatorCacheTimeout) - : base(instance, communicator, identity, facet, mode, secure, encoding) + : base(instance, communicator, identity, facet, mode, secure, protocol, encoding) { _endpoints = endpoints; _adapterId = adapterId; @@ -1386,16 +1432,13 @@ namespace IceInternal List<EndpointI> endpoints = new List<EndpointI>(); // - // Filter out incompatible endpoints (whose encoding/protocol - // versions aren't supported by this runtime, or are opaque). + // Filter out unknown endpoints. // - Ice.EncodingVersion encoding = getEncoding(); - foreach(EndpointI p in allEndpoints) + for(int i = 0; i < allEndpoints.Length; i++) { - if(Protocol.isSupported(encoding, p.encodingVersion()) && - Protocol.isSupported(Ice.Util.currentProtocol, p.protocolVersion())) + if(!(allEndpoints[i] is IceInternal.OpaqueEndpointI)) { - endpoints.Add(p); + endpoints.Add(allEndpoints[i]); } } diff --git a/cs/src/Ice/ReferenceFactory.cs b/cs/src/Ice/ReferenceFactory.cs index 05e54b8a634..6293f851d31 100644 --- a/cs/src/Ice/ReferenceFactory.cs +++ b/cs/src/Ice/ReferenceFactory.cs @@ -26,7 +26,8 @@ namespace IceInternal return null; } - return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), endpoints, null, null); + return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(), + endpoints, null, null); } public Reference @@ -40,7 +41,8 @@ namespace IceInternal // // Create new reference // - return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), null, adapterId, null); + return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(), + null, adapterId, null); } public Reference create(Ice.Identity ident, Ice.ConnectionI connection) @@ -50,8 +52,6 @@ namespace IceInternal return null; } - DefaultsAndOverrides defaultsAndOverrides = instance_.defaultsAndOverrides(); - // // Create new reference // @@ -62,7 +62,7 @@ namespace IceInternal "", // Facet connection.endpoint().datagram() ? Reference.Mode.ModeDatagram : Reference.Mode.ModeTwoway, connection.endpoint().secure(), - defaultsAndOverrides.defaultEncoding, + instance_.defaultsAndOverrides().defaultEncoding, connection); return updateCache(r); } @@ -170,6 +170,7 @@ namespace IceInternal string facet = ""; Reference.Mode mode = Reference.Mode.ModeTwoway; bool secure = false; + Ice.EncodingVersion encoding = instance_.defaultsAndOverrides().defaultEncoding; string adapter = ""; while(true) @@ -342,6 +343,25 @@ namespace IceInternal break; } + case 'e': + { + if(argument == null) + { + throw new Ice.ProxyParseException("no argument provided for -e option `" + s + "'"); + } + + try + { + encoding = Ice.Util.stringToEncodingVersion(argument); + } + catch(Ice.VersionParseException e) + { + throw new Ice.ProxyParseException("invalid encoding version `" + argument + "' in `" + s + + "':\n" + e.str); + } + break; + } + default: { Ice.ProxyParseException e = new Ice.ProxyParseException(); @@ -353,7 +373,7 @@ namespace IceInternal if(beg == -1) { - return create(ident, facet, mode, secure, null, null, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, null, null, propertyPrefix); } List<EndpointI> endpoints = new List<EndpointI>(); @@ -444,7 +464,7 @@ namespace IceInternal } EndpointI[] ep = endpoints.ToArray(); - return create(ident, facet, mode, secure, ep, null, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, ep, null, propertyPrefix); } else if(s[beg] == '@') { @@ -503,7 +523,8 @@ namespace IceInternal e.str = "empty adapter id in `" + s + "'"; throw e; } - return create(ident, facet, mode, secure, null, adapter, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, null, adapter, + propertyPrefix); } Ice.ProxyParseException ex = new Ice.ProxyParseException(); @@ -549,6 +570,21 @@ namespace IceInternal bool secure = s.readBool(); + Ice.ProtocolVersion protocol; + Ice.EncodingVersion encoding; + if(!s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) + { + protocol = new Ice.ProtocolVersion(); + protocol.read__(s); + encoding = new Ice.EncodingVersion(); + encoding.read__(s); + } + else + { + protocol = Ice.Util.Protocol_1_0; + encoding = Ice.Util.Encoding_1_0; + } + EndpointI[] endpoints = null; string adapterId = ""; @@ -566,7 +602,7 @@ namespace IceInternal adapterId = s.readString(); } - return create(ident, facet, (Reference.Mode)mode, secure, endpoints, adapterId, null); + return create(ident, facet, (Reference.Mode)mode, secure, protocol, encoding, endpoints, adapterId, null); } public ReferenceFactory setDefaultRouter(Ice.RouterPrx defaultRouter) @@ -715,6 +751,8 @@ namespace IceInternal string facet, Reference.Mode mode, bool secure, + Ice.ProtocolVersion protocol, + Ice.EncodingVersion encoding, EndpointI[] endpoints, string adapterId, string propertyPrefix) @@ -724,12 +762,23 @@ namespace IceInternal // // Default local proxy options. // - LocatorInfo locatorInfo = instance_.locatorManager().get(_defaultLocator); + LocatorInfo locatorInfo = null; + if(_defaultLocator != null) + { + if(!((Ice.ObjectPrxHelperBase)_defaultLocator).reference__().getEncoding().Equals(encoding)) + { + locatorInfo = instance_.locatorManager().get( + (Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding)); + } + else + { + locatorInfo = instance_.locatorManager().get(_defaultLocator); + } + } RouterInfo routerInfo = instance_.routerManager().get(_defaultRouter); bool collocOptimized = defaultsAndOverrides.defaultCollocationOptimization; bool cacheConnection = true; bool preferSecure = defaultsAndOverrides.defaultPreferSecure; - Ice.EncodingVersion encoding = defaultsAndOverrides.defaultEncoding; Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection; int locatorCacheTimeout = defaultsAndOverrides.defaultLocatorCacheTimeout; @@ -782,14 +831,6 @@ namespace IceInternal property = propertyPrefix + ".PreferSecure"; preferSecure = properties.getPropertyAsIntWithDefault(property, preferSecure ? 1 : 0) > 0; - property = propertyPrefix + ".EncodingVersion"; - string encodingStr = properties.getProperty(property); - if(encodingStr.Length > 0) - { - encoding = Ice.Util.stringToEncodingVersion(encodingStr); - Protocol.checkSupportedEncoding(encoding); - } - property = propertyPrefix + ".EndpointSelection"; if(properties.getProperty(property).Length > 0) { @@ -822,6 +863,7 @@ namespace IceInternal facet, mode, secure, + protocol, encoding, endpoints, adapterId, diff --git a/cs/src/Ice/TcpConnector.cs b/cs/src/Ice/TcpConnector.cs index 5f322293d20..f4862e6ed27 100644 --- a/cs/src/Ice/TcpConnector.cs +++ b/cs/src/Ice/TcpConnector.cs @@ -63,8 +63,7 @@ namespace IceInternal // // Only for use by TcpEndpoint // - internal TcpConnector(Instance instance, EndPoint addr, int timeout, Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, string connectionId) + internal TcpConnector(Instance instance, EndPoint addr, int timeout, string connectionId) { _instance = instance; _traceLevels = instance.traceLevels(); @@ -75,15 +74,11 @@ namespace IceInternal _addr = (IPEndPoint)addr; #endif _timeout = timeout; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; IceInternal.HashUtil.hashAdd(ref _hashCode, _addr); IceInternal.HashUtil.hashAdd(ref _hashCode, _timeout); - IceInternal.HashUtil.hashAdd(ref _hashCode, _protocol); - IceInternal.HashUtil.hashAdd(ref _hashCode, _encoding); IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId); } @@ -105,16 +100,6 @@ namespace IceInternal return false; } - if(!_protocol.Equals(p._protocol)) - { - return false; - } - - if(!_encoding.Equals(p._encoding)) - { - return false; - } - if(!_connectionId.Equals(p._connectionId)) { return false; @@ -142,8 +127,6 @@ namespace IceInternal private IPEndPoint _addr; #endif private int _timeout; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private string _connectionId; private int _hashCode; } diff --git a/cs/src/Ice/TcpEndpointI.cs b/cs/src/Ice/TcpEndpointI.cs index a583f1d7bca..a7b9c7fdea2 100644 --- a/cs/src/Ice/TcpEndpointI.cs +++ b/cs/src/Ice/TcpEndpointI.cs @@ -17,8 +17,7 @@ namespace IceInternal sealed class TcpEndpointI : EndpointI { - public TcpEndpointI(Instance instance, string ho, int po, int ti, Ice.ProtocolVersion pv, - Ice.EncodingVersion ev, string conId, bool co) : base(pv, ev, conId) + public TcpEndpointI(Instance instance, string ho, int po, int ti, string conId, bool co) : base(conId) { _instance = instance; _host = ho; @@ -28,8 +27,7 @@ namespace IceInternal calcHashValue(); } - public TcpEndpointI(Instance instance, string str, bool oaEndpoint) : - base(Ice.Util.currentProtocol, instance.defaultsAndOverrides().defaultEncoding, "") + public TcpEndpointI(Instance instance, string str, bool oaEndpoint) : base("") { _instance = instance; _host = null; @@ -189,16 +187,6 @@ namespace IceInternal _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); - if(!s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) - { - protocol_.read__(s); - encoding_.read__(s); - } - else - { - protocol_ = Ice.Util.Protocol_1_0; - encoding_ = Ice.Util.Encoding_1_0; - } s.endReadEncaps(); calcHashValue(); } @@ -214,11 +202,6 @@ namespace IceInternal s.writeInt(_port); s.writeInt(_timeout); s.writeBool(_compress); - if(!s.getWriteEncoding().Equals(Ice.Util.Encoding_1_0)) - { - protocol_.write__(s); - encoding_.write__(s); - } s.endWriteEncaps(); } @@ -236,16 +219,6 @@ namespace IceInternal // string s = "tcp"; - if(!protocol_.Equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(protocol_); - } - - if(!encoding_.Equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(encoding_); - } - if(_host != null && _host.Length != 0) { s += " -h "; @@ -275,8 +248,7 @@ namespace IceInternal private sealed class InfoI : Ice.TCPEndpointInfo { - public InfoI(Ice.ProtocolVersion pv, Ice.EncodingVersion ev, int to, bool comp, string host, int port) : - base(pv, ev, to, comp, host, port) + public InfoI(int to, bool comp, string host, int port) : base(to, comp, host, port) { } @@ -301,7 +273,7 @@ namespace IceInternal // public override Ice.EndpointInfo getInfo() { - return new InfoI(protocol_, encoding_, _timeout, _compress, _host, _port); + return new InfoI(_timeout, _compress, _host, _port); } // @@ -342,8 +314,7 @@ namespace IceInternal } else { - return new TcpEndpointI(_instance, _host, _port, timeout, protocol_, encoding_, connectionId_, - _compress); + return new TcpEndpointI(_instance, _host, _port, timeout, connectionId_, _compress); } } @@ -358,8 +329,7 @@ namespace IceInternal } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, protocol_, encoding_, connectionId, - _compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -385,8 +355,7 @@ namespace IceInternal } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, protocol_, encoding_, connectionId_, - compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId_, compress); } } @@ -452,8 +421,7 @@ namespace IceInternal throw new Ice.FeatureNotSupportedException("server endpoint not supported for `" + ToString() + "'"); #else TcpAcceptor p = new TcpAcceptor(_instance, _host, _port); - endpoint = new TcpEndpointI(_instance, _host, p.effectivePort(), _timeout, protocol_, encoding_, - connectionId_, _compress); + endpoint = new TcpEndpointI(_instance, _host, p.effectivePort(), _timeout, connectionId_, _compress); return p; #endif } @@ -474,8 +442,7 @@ namespace IceInternal { foreach(string h in hosts) { - endps.Add(new TcpEndpointI(_instance, h, _port, _timeout, protocol_, encoding_, connectionId_, - _compress)); + endps.Add(new TcpEndpointI(_instance, h, _port, _timeout, connectionId_, _compress)); } } return endps; @@ -500,7 +467,7 @@ namespace IceInternal List<Connector> connectors = new List<Connector>(); foreach(EndPoint addr in addresses) { - connectors.Add(new TcpConnector(_instance, addr, _timeout, protocol_, encoding_, connectionId_)); + connectors.Add(new TcpConnector(_instance, addr, _timeout, connectionId_)); } return connectors; } @@ -571,8 +538,6 @@ namespace IceInternal IceInternal.HashUtil.hashAdd(ref h, _host); IceInternal.HashUtil.hashAdd(ref h, _port); IceInternal.HashUtil.hashAdd(ref h, _timeout); - IceInternal.HashUtil.hashAdd(ref h, protocol_); - IceInternal.HashUtil.hashAdd(ref h, encoding_); IceInternal.HashUtil.hashAdd(ref h, connectionId_); IceInternal.HashUtil.hashAdd(ref h, _compress); _hashCode = h; diff --git a/cs/src/Ice/UdpConnector.cs b/cs/src/Ice/UdpConnector.cs index 2523d4cb373..740c4a58def 100644 --- a/cs/src/Ice/UdpConnector.cs +++ b/cs/src/Ice/UdpConnector.cs @@ -30,7 +30,7 @@ namespace IceInternal // Only for use by TcpEndpoint // internal UdpConnector(Instance instance, EndPoint addr, string mcastInterface, int mcastTtl, - Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, string connectionId) + string connectionId) { instance_ = instance; #if SILVERLIGHT @@ -40,15 +40,11 @@ namespace IceInternal #endif _mcastInterface = mcastInterface; _mcastTtl = mcastTtl; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; IceInternal.HashUtil.hashAdd(ref _hashCode, _addr); IceInternal.HashUtil.hashAdd(ref _hashCode, _mcastInterface); - IceInternal.HashUtil.hashAdd(ref _hashCode, _protocol); - IceInternal.HashUtil.hashAdd(ref _hashCode, _encoding); IceInternal.HashUtil.hashAdd(ref _hashCode, _mcastTtl); IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId); } @@ -71,16 +67,6 @@ namespace IceInternal return false; } - if(!_protocol.Equals(p._protocol)) - { - return false; - } - - if(!_encoding.Equals(p._encoding)) - { - return false; - } - if(!_mcastInterface.Equals(p._mcastInterface)) { return false; @@ -112,8 +98,6 @@ namespace IceInternal #endif private string _mcastInterface; private int _mcastTtl; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private string _connectionId; private int _hashCode; } diff --git a/cs/src/Ice/UdpEndpointI.cs b/cs/src/Ice/UdpEndpointI.cs index 9350e5a42e7..9038ad81e4f 100644 --- a/cs/src/Ice/UdpEndpointI.cs +++ b/cs/src/Ice/UdpEndpointI.cs @@ -19,8 +19,8 @@ namespace IceInternal sealed class UdpEndpointI : EndpointI { - public UdpEndpointI(Instance instance, string ho, int po, string mif, int mttl, Ice.ProtocolVersion pv, - Ice.EncodingVersion ev, bool conn, string conId, bool co) : base(pv, ev, conId) + public UdpEndpointI(Instance instance, string ho, int po, string mif, int mttl, bool conn, string conId, + bool co) : base(conId) { instance_ = instance; _host = ho; @@ -33,8 +33,7 @@ namespace IceInternal calcHashValue(); } - public UdpEndpointI(Instance instance, string str, bool oaEndpoint) : - base(Ice.Util.currentProtocol, instance.defaultsAndOverrides().defaultEncoding, "") + public UdpEndpointI(Instance instance, string str, bool oaEndpoint) : base("") { instance_ = instance; _host = null; @@ -163,6 +162,14 @@ namespace IceInternal _compress = true; } + else if(option == "-v") + { + instance_.initializationData().logger.warning("deprecated udp endpoint option: -v"); + } + else if(option == "-e") + { + instance_.initializationData().logger.warning("deprecated udp endpoint option: -e"); + } else if(option.Equals("--interface")) { if(argument == null) @@ -237,8 +244,13 @@ namespace IceInternal s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); - protocol_.read__(s); - encoding_.read__(s); + if(s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) + { + s.readByte(); + s.readByte(); + s.readByte(); + s.readByte(); + } // Not transmitted. //_connect = s.readBool(); _connect = false; @@ -256,8 +268,11 @@ namespace IceInternal s.startWriteEncaps(); s.writeString(_host); s.writeInt(_port); - protocol_.write__(s); - encoding_.write__(s); + if(s.getWriteEncoding().Equals(Ice.Util.Encoding_1_0)) + { + Ice.Util.Protocol_1_0.write__(s); + Ice.Util.Encoding_1_0.write__(s); + } // Not transmitted. //s.writeBool(_connect); s.writeBool(_compress); @@ -278,16 +293,6 @@ namespace IceInternal // string s = "udp"; - if(!protocol_.Equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(protocol_); - } - - if(!encoding_.Equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(encoding_); - } - if(_host != null && _host.Length != 0) { s += " -h "; @@ -330,9 +335,8 @@ namespace IceInternal private sealed class InfoI : Ice.UDPEndpointInfo { - public InfoI(bool comp, string host, int port, Ice.ProtocolVersion pv, Ice.EncodingVersion ev, - string mcastInterface, int mcastTtl) : - base(pv, ev, -1, comp, host, port, mcastInterface, mcastTtl) + public InfoI(bool comp, string host, int port, string mcastInterface, int mcastTtl) : + base(-1, comp, host, port, mcastInterface, mcastTtl) { } @@ -357,7 +361,7 @@ namespace IceInternal // public override Ice.EndpointInfo getInfo() { - return new InfoI(_compress, _host, _port, protocol_, encoding_, _mcastInterface, _mcastTtl); + return new InfoI(_compress, _host, _port, _mcastInterface, _mcastTtl); } // @@ -407,8 +411,8 @@ namespace IceInternal } else { - return new UdpEndpointI(instance_, _host, _port, _mcastInterface, _mcastTtl, protocol_, encoding_, - _connect, connectionId_, compress); + return new UdpEndpointI(instance_, _host, _port, _mcastInterface, _mcastTtl, _connect, connectionId_, + compress); } } @@ -423,8 +427,8 @@ namespace IceInternal } else { - return new UdpEndpointI(instance_, _host, _port, _mcastInterface, _mcastTtl, protocol_, encoding_, - _connect, connectionId, _compress); + return new UdpEndpointI(instance_, _host, _port, _mcastInterface, _mcastTtl, _connect, connectionId, + _compress); } } @@ -465,7 +469,7 @@ namespace IceInternal { UdpTransceiver p = new UdpTransceiver(instance_, _host, _port, _mcastInterface, _connect); endpoint = new UdpEndpointI(instance_, _host, p.effectivePort(), _mcastInterface, _mcastTtl, - protocol_, encoding_, _connect, connectionId_, _compress); + _connect, connectionId_, _compress); return p; } @@ -518,8 +522,8 @@ namespace IceInternal { foreach(string h in hosts) { - endps.Add(new UdpEndpointI(instance_, h, _port, _mcastInterface, _mcastTtl, protocol_, encoding_, - _connect, connectionId_, _compress)); + endps.Add(new UdpEndpointI(instance_, h, _port, _mcastInterface, _mcastTtl, _connect, + connectionId_, _compress)); } } return endps; @@ -544,8 +548,7 @@ namespace IceInternal List<Connector> connectors = new List<Connector>(); foreach(EndPoint addr in addresses) { - connectors.Add(new UdpConnector(instance_, addr, _mcastInterface, _mcastTtl, protocol_, encoding_, - connectionId_)); + connectors.Add(new UdpConnector(instance_, addr, _mcastInterface, _mcastTtl, connectionId_)); } return connectors; } @@ -638,8 +641,6 @@ namespace IceInternal IceInternal.HashUtil.hashAdd(ref h, _mcastInterface); IceInternal.HashUtil.hashAdd(ref h, _mcastTtl); IceInternal.HashUtil.hashAdd(ref h, _connect); - IceInternal.HashUtil.hashAdd(ref h, protocol_); - IceInternal.HashUtil.hashAdd(ref h, encoding_); IceInternal.HashUtil.hashAdd(ref h, connectionId_); IceInternal.HashUtil.hashAdd(ref h, _compress); _hashCode = h; diff --git a/cs/src/IceSSL/ConnectorI.cs b/cs/src/IceSSL/ConnectorI.cs index 3d543c2d67c..3c2cb6329b9 100644 --- a/cs/src/IceSSL/ConnectorI.cs +++ b/cs/src/IceSSL/ConnectorI.cs @@ -76,23 +76,18 @@ namespace IceSSL // // Only for use by EndpointI. // - internal ConnectorI(Instance instance, string host, EndPoint addr, int timeout, Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, string connectionId) + internal ConnectorI(Instance instance, string host, EndPoint addr, int timeout, string connectionId) { _instance = instance; _host = host; _logger = instance.communicator().getLogger(); _addr = (IPEndPoint)addr; _timeout = timeout; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; IceInternal.HashUtil.hashAdd(ref _hashCode, _addr); IceInternal.HashUtil.hashAdd(ref _hashCode, _timeout); - IceInternal.HashUtil.hashAdd(ref _hashCode, _protocol); - IceInternal.HashUtil.hashAdd(ref _hashCode, _encoding); IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId); } @@ -114,16 +109,6 @@ namespace IceSSL return false; } - if(!_protocol.Equals(p._protocol)) - { - return false; - } - - if(!_encoding.Equals(p._encoding)) - { - return false; - } - if(!_connectionId.Equals(p._connectionId)) { return false; @@ -147,8 +132,6 @@ namespace IceSSL private string _host; private IPEndPoint _addr; private int _timeout; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private string _connectionId; private int _hashCode; } diff --git a/cs/src/IceSSL/EndpointI.cs b/cs/src/IceSSL/EndpointI.cs index d78953f4b9f..2938c7a684b 100644 --- a/cs/src/IceSSL/EndpointI.cs +++ b/cs/src/IceSSL/EndpointI.cs @@ -17,8 +17,7 @@ namespace IceSSL sealed class EndpointI : IceInternal.EndpointI { - internal EndpointI(Instance instance, string ho, int po, int ti, Ice.ProtocolVersion pv, - Ice.EncodingVersion ev, string conId, bool co) : base(pv, ev, conId) + internal EndpointI(Instance instance, string ho, int po, int ti, string conId, bool co) : base(conId) { _instance = instance; _host = ho; @@ -29,8 +28,7 @@ namespace IceSSL calcHashValue(); } - internal EndpointI(Instance instance, string str, bool oaEndpoint) : - base(Ice.Util.currentProtocol, instance.defaultEncoding(), "") + internal EndpointI(Instance instance, string str, bool oaEndpoint) : base("") { _instance = instance; _host = null; @@ -190,16 +188,6 @@ namespace IceSSL _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); - if(!s.getReadEncoding().Equals(Ice.Util.Encoding_1_0)) - { - protocol_.read__(s); - encoding_.read__(s); - } - else - { - protocol_ = Ice.Util.Protocol_1_0; - encoding_ = Ice.Util.Encoding_1_0; - } s.endReadEncaps(); calcHashValue(); } @@ -215,11 +203,6 @@ namespace IceSSL s.writeInt(_port); s.writeInt(_timeout); s.writeBool(_compress); - if(!s.getWriteEncoding().Equals(Ice.Util.Encoding_1_0)) - { - protocol_.write__(s); - encoding_.write__(s); - } s.endWriteEncaps(); } @@ -237,16 +220,6 @@ namespace IceSSL // string s = "ssl"; - if(!protocol_.Equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(protocol_); - } - - if(!encoding_.Equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(encoding_); - } - if(_host != null && _host.Length != 0) { s += " -h "; @@ -275,8 +248,7 @@ namespace IceSSL private sealed class InfoI : IceSSL.EndpointInfo { - public InfoI(Ice.ProtocolVersion pv, Ice.EncodingVersion ev, int to, bool comp, string h, int p) : - base(pv, ev, to, comp, h, p) + public InfoI(int to, bool comp, string h, int p) : base(to, comp, h, p) { } @@ -301,7 +273,7 @@ namespace IceSSL // public override Ice.EndpointInfo getInfo() { - return new InfoI(protocol_, encoding_, _timeout, _compress, _host, _port); + return new InfoI(_timeout, _compress, _host, _port); } // @@ -342,7 +314,7 @@ namespace IceSSL } else { - return new EndpointI(_instance, _host, _port, timeout, protocol_, encoding_, connectionId_, _compress); + return new EndpointI(_instance, _host, _port, timeout, connectionId_, _compress); } } @@ -357,7 +329,7 @@ namespace IceSSL } else { - return new EndpointI(_instance, _host, _port, _timeout, protocol_, encoding_, connectionId, _compress); + return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -383,7 +355,7 @@ namespace IceSSL } else { - return new EndpointI(_instance, _host, _port, _timeout, protocol_, encoding_, connectionId_, compress); + return new EndpointI(_instance, _host, _port, _timeout, connectionId_, compress); } } @@ -440,8 +412,7 @@ namespace IceSSL public override IceInternal.Acceptor acceptor(ref IceInternal.EndpointI endpoint, string adapterName) { AcceptorI p = new AcceptorI(_instance, adapterName, _host, _port); - endpoint = new EndpointI(_instance, _host, p.effectivePort(), _timeout, protocol_, encoding_, - connectionId_, _compress); + endpoint = new EndpointI(_instance, _host, p.effectivePort(), _timeout, connectionId_, _compress); return p; } @@ -462,8 +433,7 @@ namespace IceSSL { foreach(string h in hosts) { - endps.Add(new EndpointI(_instance, h, _port, _timeout, protocol_, encoding_, connectionId_, - _compress)); + endps.Add(new EndpointI(_instance, h, _port, _timeout, connectionId_, _compress)); } } return endps; @@ -488,7 +458,7 @@ namespace IceSSL List<IceInternal.Connector> connectors = new List<IceInternal.Connector>(); foreach(EndPoint addr in addresses) { - connectors.Add(new ConnectorI(_instance, _host, addr, _timeout, protocol_, encoding_, connectionId_)); + connectors.Add(new ConnectorI(_instance, _host, addr, _timeout, connectionId_)); } return connectors; } @@ -564,8 +534,6 @@ namespace IceSSL IceInternal.HashUtil.hashAdd(ref h, _host); IceInternal.HashUtil.hashAdd(ref h, _port); IceInternal.HashUtil.hashAdd(ref h, _timeout); - IceInternal.HashUtil.hashAdd(ref h, protocol_); - IceInternal.HashUtil.hashAdd(ref h, encoding_); IceInternal.HashUtil.hashAdd(ref h, connectionId_); IceInternal.HashUtil.hashAdd(ref h, _compress); _hashCode = h; diff --git a/cs/test/Ice/info/AllTests.cs b/cs/test/Ice/info/AllTests.cs index 1f3a18604a4..7d39857617c 100644 --- a/cs/test/Ice/info/AllTests.cs +++ b/cs/test/Ice/info/AllTests.cs @@ -37,17 +37,14 @@ public class AllTests : TestCommon.TestApp Write("testing proxy endpoint information... "); Flush(); { - Ice.ObjectPrx p1 = communicator.stringToProxy( - "test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + - "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + - "opaque -e 1.8 -t 100 -v ABCD"); + Ice.ObjectPrx p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + + "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + + "opaque -e 1.8 -t 100 -v ABCD"); Ice.Endpoint[] endps = p1.ice_getEndpoints(); Ice.IPEndpointInfo ipEndpoint = (Ice.IPEndpointInfo)endps[0].getInfo(); - test(ipEndpoint.protocol.Equals(new Ice.ProtocolVersion(1, 4))); - test(ipEndpoint.encoding.Equals(new Ice.EncodingVersion(1, 3))); test(ipEndpoint.host.Equals("tcphost")); test(ipEndpoint.port == 10000); test(ipEndpoint.timeout == 1200); @@ -65,8 +62,6 @@ public class AllTests : TestCommon.TestApp #endif Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo(); - test(udpEndpoint.protocol.Equals(Ice.Util.currentProtocol)); - test(udpEndpoint.encoding.Equals(Ice.Util.currentEncoding)); test(udpEndpoint.host.Equals("udphost")); test(udpEndpoint.port == 10001); test(udpEndpoint.mcastInterface.Equals("eth0")); diff --git a/cs/test/Ice/info/TestI.cs b/cs/test/Ice/info/TestI.cs index 54abf20f858..8d973e67cf2 100644 --- a/cs/test/Ice/info/TestI.cs +++ b/cs/test/Ice/info/TestI.cs @@ -34,10 +34,6 @@ public class TestI : TestIntfDisp_ if(ipinfo is Ice.UDPEndpointInfo) { Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)ipinfo; - ctx["protocolMajor"] = udp.protocol.major.ToString(); - ctx["protocolMinor"] = udp.protocol.minor.ToString(); - ctx["encodingMajor"] = udp.encoding.major.ToString(); - ctx["encodingMinor"] = udp.encoding.minor.ToString(); ctx["mcastInterface"] = udp.mcastInterface; ctx["mcastTtl"] = udp.mcastTtl.ToString(); } diff --git a/cs/test/Ice/location/AllTests.cs b/cs/test/Ice/location/AllTests.cs index c463444de8b..c72a08d9bbd 100644 --- a/cs/test/Ice/location/AllTests.cs +++ b/cs/test/Ice/location/AllTests.cs @@ -553,6 +553,18 @@ public class AllTests : TestCommon.TestApp hello.sayHello(); WriteLine("ok"); + Write("testing locator encoding resolution... "); + Flush(); + hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); + count = locator.getRequestCount(); + communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Ice.Util.Encoding_1_1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test -e 1.0@TestAdapter10-2").ice_ping(); + test(++count == locator.getRequestCount()); + WriteLine("ok"); + Write("shutdown server... "); Flush(); obj.shutdown(); diff --git a/cs/test/Ice/location/ServerLocator.cs b/cs/test/Ice/location/ServerLocator.cs index 584878cc09a..20c4587e3bc 100644 --- a/cs/test/Ice/location/ServerLocator.cs +++ b/cs/test/Ice/location/ServerLocator.cs @@ -7,6 +7,8 @@ // // ********************************************************************** +using System.Diagnostics; + public class ServerLocator : Test.TestLocatorDisp_ { public ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx) @@ -20,6 +22,13 @@ public class ServerLocator : Test.TestLocatorDisp_ Ice.Current current) { ++_requestCount; + if(adapter.Equals("TestAdapter10") || adapter.Equals("TestAdapter10-2")) + { + Debug.Assert(current.encoding.Equals(Ice.Util.Encoding_1_0)); + response.ice_response(_registry.getAdapter("TestAdapter")); + return; + } + // We add a small delay to make sure locator request queuing gets tested when // running the test on a fast machine System.Threading.Thread.Sleep(1); diff --git a/cs/test/Ice/metrics/AllTests.cs b/cs/test/Ice/metrics/AllTests.cs index a4670d3db33..8a5c5ddb3ca 100644 --- a/cs/test/Ice/metrics/AllTests.cs +++ b/cs/test/Ice/metrics/AllTests.cs @@ -571,13 +571,11 @@ public class AllTests : TestCommon.TestApp testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator"); //testAttribute(clientMetrics, clientProps, update, "Connection", "id", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 500"); + "tcp -h 127.0.0.1 -p 12010 -t 500"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "False"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "False"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointProtocolVersion", "1.0"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointEncodingVersion", "1.1"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "False"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1"); @@ -642,15 +640,11 @@ public class AllTests : TestCommon.TestApp 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 -e 1.1 -h 127.0.0.1 -p 12010", c); + "tcp -h 127.0.0.1 -p 12010", 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", "endpointProtocolVersion", "1.0", - c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointEncodingVersion", "1.1", - c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "False", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c); @@ -670,7 +664,7 @@ public class AllTests : TestCommon.TestApp test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 1); m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0]; - test(m1.current <= 1 && m1.total == 1 && m1.id.Equals("tcp -e 1.1 -h localhost -p 12010")); + test(m1.current <= 1 && m1.total == 1 && m1.id.Equals("tcp -h localhost -p 12010")); prx.ice_getConnection().close(false); @@ -688,27 +682,25 @@ public class AllTests : TestCommon.TestApp } test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 2); m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0]; - if(!m1.id.Equals("tcp -e 1.1 -h unknownfoo.zeroc.com -p 12010")) + if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010")) { m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][1]; } - test(m1.id.Equals("tcp -e 1.1 -h unknownfoo.zeroc.com -p 12010") && m1.total == 2 && m1.failures == 2); + test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010") && m1.total == 2 && m1.failures == 2); checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2); c = () => { connect(prx); }; testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -e 1.1 -h localhost -p 12010", + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", - "tcp -e 1.1 -h localhost -p 12010", c); + "tcp -h localhost -p 12010", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "False", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "False", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointProtocolVersion", "1.0", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointEncodingVersion", "1.1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "False", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c); @@ -796,14 +788,12 @@ public class AllTests : TestCommon.TestApp testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010", op); + "tcp -h 127.0.0.1 -p 12010", 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", "endpointProtocolVersion", "1.0", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointEncodingVersion", "1.1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "False", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op); @@ -980,7 +970,7 @@ public class AllTests : TestCommon.TestApp testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "id", - "metrics -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 [op]", op); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 [op]", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "operation", "op", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "identity", "metrics", op); @@ -988,7 +978,7 @@ public class AllTests : TestCommon.TestApp 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:tcp -e 1.1 -h 127.0.0.1 -p 12010", op); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry1", "test", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry2", "", op); diff --git a/cs/test/Ice/proxy/AllTests.cs b/cs/test/Ice/proxy/AllTests.cs index 0f605d4c8db..a485d15a4d3 100644 --- a/cs/test/Ice/proxy/AllTests.cs +++ b/cs/test/Ice/proxy/AllTests.cs @@ -341,31 +341,6 @@ public class AllTests : TestCommon.TestApp test(!b1.ice_isCollocationOptimized()); prop.setProperty(property, ""); - property = propertyPrefix + ".EncodingVersion"; - test(b1.ice_getEncodingVersion().Equals(Ice.Util.currentEncoding)); - prop.setProperty(property, "1.0"); - b1 = communicator.propertyToProxy(propertyPrefix); - test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0); - prop.setProperty(property, "6.5"); - try - { - communicator.propertyToProxy(propertyPrefix); - test(false); - } - catch(Ice.UnsupportedEncodingException) - { - } - prop.setProperty(property, "1.2"); - try - { - communicator.propertyToProxy(propertyPrefix); - test(false); - } - catch(Ice.UnsupportedEncodingException) - { - } - prop.setProperty(property, ""); - WriteLine("ok"); Write("testing proxyToProperty... "); @@ -397,28 +372,25 @@ public class AllTests : TestCommon.TestApp b1 = b1.ice_locator(Ice.LocatorPrxHelper.uncheckedCast(locator)); Dictionary<string, string> proxyProps = communicator.proxyToProperty(b1, "Test"); - test(proxyProps.Count == 21); + test(proxyProps.Count == 18); test(proxyProps["Test"].Equals("test -t")); - test(proxyProps["Test.EncodingVersion"].Equals("1.0")); test(proxyProps["Test.CollocationOptimized"].Equals("1")); test(proxyProps["Test.ConnectionCached"].Equals("1")); test(proxyProps["Test.PreferSecure"].Equals("0")); test(proxyProps["Test.EndpointSelection"].Equals("Ordered")); test(proxyProps["Test.LocatorCacheTimeout"].Equals("100")); - test(proxyProps["Test.Locator"].Equals("locator -t")); - test(proxyProps["Test.Locator.EncodingVersion"].Equals( - Ice.Util.encodingVersionToString(Ice.Util.currentEncoding))); + test(proxyProps["Test.Locator"].Equals( + "locator -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding))); test(proxyProps["Test.Locator.CollocationOptimized"].Equals("1")); test(proxyProps["Test.Locator.ConnectionCached"].Equals("0")); test(proxyProps["Test.Locator.PreferSecure"].Equals("1")); test(proxyProps["Test.Locator.EndpointSelection"].Equals("Random")); test(proxyProps["Test.Locator.LocatorCacheTimeout"].Equals("300")); - test(proxyProps["Test.Locator.Router"].Equals("router -t")); - test(proxyProps["Test.Locator.Router.EncodingVersion"].Equals( - Ice.Util.encodingVersionToString(Ice.Util.currentEncoding))); + test(proxyProps["Test.Locator.Router"].Equals( + "router -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding))); test(proxyProps["Test.Locator.Router.CollocationOptimized"].Equals("0")); test(proxyProps["Test.Locator.Router.ConnectionCached"].Equals("1")); test(proxyProps["Test.Locator.Router.PreferSecure"].Equals("1")); @@ -568,36 +540,73 @@ public class AllTests : TestCommon.TestApp test(Ice.CollectionComparer.Equals(c, c2)); WriteLine("ok"); + Write("testing protocol versioning... "); + Flush(); + { + Ice.OutputStream outS = Ice.Util.createOutputStream(communicator); + outS.writeProxy(cl); + byte[] inBytes = outS.finished(); + + // Protocol version 1.1 + inBytes[9] = 1; + inBytes[10] = 1; + + Ice.InputStream inS = Ice.Util.createInputStream(communicator, inBytes); + Test.MyClassPrx cl11 = Test.MyClassPrxHelper.uncheckedCast(inS.readProxy().ice_collocationOptimized(false)); + test(cl11.ToString().Equals("test -t -p 1.1 -e 1.1:tcp -h 127.0.0.1 -p 12010")); + try + { + cl11.ice_ping(); + test(false); + } + catch(Ice.UnsupportedProtocolException) + { + } + try + { + cl11.end_ice_ping(cl11.begin_ice_ping()); + test(false); + } + catch(Ice.UnsupportedProtocolException) + { + } + try + { + cl11.ice_flushBatchRequests(); + test(false); + } + catch(Ice.UnsupportedProtocolException) + { + } + try + { + cl11.end_ice_flushBatchRequests(cl11.begin_ice_flushBatchRequests()); + test(false); + } + catch(Ice.UnsupportedProtocolException) + { + } + } + WriteLine("ok"); + Write("testing encoding versioning... "); Flush(); - string ref20 = "test:default -p 12010 -e 2.0"; + string ref20 = "test -e 2.0:default -p 12010"; Test.MyClassPrx cl20 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { cl20.ice_collocationOptimized(false).ice_ping(); test(false); } - catch(Ice.NoEndpointException) + catch(Ice.UnsupportedEncodingException) { // Server 2.0 endpoint doesn't support 1.1 version. } - string ref10 = "test:default -p 12010 -e 1.0"; + string ref10 = "test -e 1.0:default -p 12010"; Test.MyClassPrx cl10 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); - try - { - cl10.ice_collocationOptimized(false).ice_ping(); // Can't send request with 1.1 encoding on 1.0 endpoint. - test(false); - } - catch(Ice.NoEndpointException) - { - // Server 1.0 endpoint doesn't support 1.1 version. - } - - // Server with 1.0 endpoint supports 1.0 encoding. + cl10.ice_ping(); cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - - // Server with 1.1 endpoint supports 1.0 encoding. cl.ice_collocationOptimized(false).ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); try @@ -758,18 +767,14 @@ public class AllTests : TestCommon.TestApp } // Legal TCP endpoint expressed as opaque endpoint - Ice.ObjectPrx p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + Ice.ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); string pstr = communicator.proxyToString(p1); - test(pstr.Equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000")); + test(pstr.Equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000")); - // 1.1 TCP endpoint encoded with 1.1 encoding. - Ice.ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE="); - test(communicator.proxyToString(p2).Equals("test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000")); + // Opaque endpoint encoded with 1.1 encoding. + Ice.ObjectPrx p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + test(communicator.proxyToString(p2).Equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000")); - // 1.0 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA="); - test(communicator.proxyToString(p2).Equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000")); - if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0) { // Working? @@ -780,12 +785,12 @@ public class AllTests : TestCommon.TestApp } // Two legal TCP endpoints expressed as opaque endpoints - p1 = communicator.stringToProxy("test:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); + p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); pstr = communicator.proxyToString(p1); test(pstr.Equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000")); // Test that an SSL endpoint and a nonsense endpoint get written back out as an opaque endpoint. - p1 = communicator.stringToProxy("test:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch"); + p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.0 -t 99 -v abch"); pstr = communicator.proxyToString(p1); if(!ssl) { @@ -795,38 +800,6 @@ public class AllTests : TestCommon.TestApp { test(pstr.Equals("test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch")); } - - // Try to invoke on the SSL endpoint to verify that we get a - // NoEndpointException (or ConnectionRefusedException when - // running with SSL). - try - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - test(false); - } - catch(Ice.NoEndpointException) - { - test(!ssl); - } - catch(Ice.ConnectionRefusedException) - { - test(ssl); - } - - // Test that the proxy with an SSL endpoint and a nonsense - // endpoint (which the server doesn't understand either) - // can be sent over the wire and returned by the server - // without losing the opaque endpoints. - p2 = derived.echo(p1); - pstr = communicator.proxyToString(p2); - if(!ssl) - { - test(pstr.Equals("test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch")); - } - else - { - test(pstr.Equals("test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch")); - } } WriteLine("ok"); diff --git a/java/build.xml b/java/build.xml index 6d37cf05025..5c0053d2ed3 100644 --- a/java/build.xml +++ b/java/build.xml @@ -26,7 +26,8 @@ <!-- This target cannot depend on init because the tasks may not be compiled yet --> <target name="tasks" depends="config-init" unless="ice.bin.dist"> <mkdir dir="${lib.dir}/ant"/> - <javac srcdir="${src.dir}/ant" destdir="${lib.dir}/ant" source="1.6" target="1.6" includes="**" deprecation="on"> + <javac srcdir="${src.dir}/ant" destdir="${lib.dir}/ant" source="1.6" target="1.6" includes="**" + deprecation="on"> <compilerarg value="${javac.lint}"/> </javac> <jar jarfile="${lib.dir}/ant-ice.jar" basedir="${lib.dir}/ant"> @@ -200,7 +201,8 @@ <include name="IceUtil/*.java"/> <include name="IceUtilInternal/*.java"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <compilerarg value="${javac.lint}"/> <include name="Ice/*.java"/> <include name="IceMX/*.java"/> @@ -244,7 +246,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="Freeze/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <classpath> <path refid="db.classpath"/> </classpath> @@ -276,7 +279,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="Glacier2/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <include name="Glacier2/**"/> <compilerarg value="${javac.lint}"/> </javac> @@ -303,7 +307,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="IceBox/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <include name="IceBox/**"/> <compilerarg value="${javac.lint}"/> </javac> @@ -330,7 +335,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="IceStorm/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <include name="IceStorm/**"/> <compilerarg value="${javac.lint}"/> </javac> @@ -357,7 +363,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="IceGrid/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <include name="IceGrid/**"/> <compilerarg value="${javac.lint}"/> </javac> @@ -384,7 +391,8 @@ <depend srcdir=".:${src.dir}:${generated.dir}:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <include name="IcePatch2/**"/> </depend> - <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" deprecation="on"> + <javac srcdir="${src.dir}:${generated.dir}" destdir="${lib.dir}" source="1.6" target="1.6" debug="${debug}" + deprecation="on"> <include name="IcePatch2/**"/> <compilerarg value="${javac.lint}"/> </javac> diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 7f62f46ab80..d1fc853f6c1 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -1451,7 +1451,6 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable } else { - IceInternal.Protocol.checkSupportedEncoding(e); return newInstance(_reference.changeEncoding(e)); } } @@ -1464,7 +1463,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable public final Ice.EncodingVersion ice_getEncodingVersion() { - return _reference.getEncoding(); + return (Ice.EncodingVersion)_reference.getEncoding().clone(); } /** diff --git a/java/src/IceInternal/BatchOutgoing.java b/java/src/IceInternal/BatchOutgoing.java index 69bb30285a5..07538a445b8 100644 --- a/java/src/IceInternal/BatchOutgoing.java +++ b/java/src/IceInternal/BatchOutgoing.java @@ -30,6 +30,7 @@ public final class BatchOutgoing implements OutgoingMessageCallback _sent = false; _os = new BasicStream(handler.getReference().getInstance(), Protocol.currentProtocolEncoding); _observer = observer; + Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); } public void diff --git a/java/src/IceInternal/CommunicatorObserverI.java b/java/src/IceInternal/CommunicatorObserverI.java index 49858cfc5d3..a8f1c68b08f 100644 --- a/java/src/IceInternal/CommunicatorObserverI.java +++ b/java/src/IceInternal/CommunicatorObserverI.java @@ -23,8 +23,6 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb r.add("endpointType", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("type")); r.add("endpointIsDatagram", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("datagram")); r.add("endpointIsSecure", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("secure")); - r.add("endpointProtocolVersion", cl.getDeclaredMethod("getEndpointProtocolVersion")); - r.add("endpointEncodingVersion", cl.getDeclaredMethod("getEndpointEncodingVersion")); r.add("endpointTimeout", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("timeout")); r.add("endpointCompress", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("compress")); @@ -165,18 +163,6 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _endpointInfo; } - public String - getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - - public String - getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - private final Ice.ConnectionInfo _connectionInfo; private final Ice.Endpoint _endpoint; private final Ice.Instrumentation.ConnectionState _state; @@ -287,18 +273,6 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _endpointInfo; } - public String - getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - - public String - getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - public Ice.Current getCurrent() { @@ -562,18 +536,6 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } public String - getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - - public String - getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - - public String getParent() { return "Communicator"; diff --git a/java/src/IceInternal/EndpointI.java b/java/src/IceInternal/EndpointI.java index 60af992f668..f3a6949bc1a 100644 --- a/java/src/IceInternal/EndpointI.java +++ b/java/src/IceInternal/EndpointI.java @@ -11,17 +11,13 @@ package IceInternal; abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<EndpointI> { - public EndpointI(Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, String connectionId) + public EndpointI(String connectionId) { - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; } public EndpointI() { - _protocol = (Ice.ProtocolVersion)Protocol.currentProtocol; - _encoding = (Ice.EncodingVersion)Protocol.currentEncoding; } public String @@ -87,22 +83,6 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En public abstract boolean secure(); // - // Return the protocol supported by the endpoint. - // - public Ice.ProtocolVersion protocolVersion() - { - return _protocol; - } - - // - // Return the encoding supported by the endpoint. - // - public Ice.EncodingVersion encodingVersion() - { - return _encoding; - } - - // // Return the connection ID // public String connectionId() @@ -160,42 +140,6 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En public int compareTo(EndpointI p) // From java.lang.Comparable. { - if(_protocol.major < p._protocol.major) - { - return -1; - } - else if(p._protocol.major < _protocol.major) - { - return 1; - } - - if(_protocol.minor < p._protocol.minor) - { - return -1; - } - else if(p._protocol.minor < _protocol.minor) - { - return 1; - } - - if(_encoding.major < p._encoding.major) - { - return -1; - } - else if(p._encoding.major < _encoding.major) - { - return 1; - } - - if(_encoding.minor < p._encoding.minor) - { - return -1; - } - else if(p._encoding.minor < _encoding.minor) - { - return 1; - } - if(!_connectionId.equals(p._connectionId)) { return _connectionId.compareTo(p._connectionId); @@ -215,52 +159,5 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En return null; } - protected void - parseOption(String option, String arg, String desc, String str) - { - if(option.equals("-v")) - { - if(arg == null) - { - throw new Ice.EndpointParseException("no argument provided for -v option in endpoint `" + - desc + " "+ str + "'"); - } - - try - { - _protocol = Ice.Util.stringToProtocolVersion(arg); - } - catch(Ice.VersionParseException e) - { - throw new Ice.EndpointParseException("invalid protocol version `" + arg + "' in endpoint `" + - desc + " "+ str + "':\n" + e.str); - } - } - else if(option.equals("-e")) - { - if(arg == null) - { - throw new Ice.EndpointParseException("no argument provided for -e option in endpoint `" + - desc + " " + str + "'"); - } - - try - { - _encoding = Ice.Util.stringToEncodingVersion(arg); - } - catch(Ice.VersionParseException e) - { - throw new Ice.EndpointParseException("invalid encoding version `" + arg + "' in endpoint `" + - desc + " "+ str + "':\n" + e.str); - } - } - else - { - throw new Ice.EndpointParseException("unknown option `" + option + "' in `" + desc + " " + str + "'"); - } - } - - protected Ice.ProtocolVersion _protocol; - protected Ice.EncodingVersion _encoding; protected String _connectionId = ""; } diff --git a/java/src/IceInternal/FixedReference.java b/java/src/IceInternal/FixedReference.java index 1c5233f77ca..020db4a4ca8 100644 --- a/java/src/IceInternal/FixedReference.java +++ b/java/src/IceInternal/FixedReference.java @@ -21,7 +21,7 @@ public class FixedReference extends Reference Ice.EncodingVersion encoding, Ice.ConnectionI connection) { - super(instance, communicator, identity, facet, mode, secure, encoding); + super(instance, communicator, identity, facet, mode, secure, Ice.Util.Protocol_1_0, encoding); _fixedConnection = connection; } diff --git a/java/src/IceInternal/InvocationObserverI.java b/java/src/IceInternal/InvocationObserverI.java index b04cdde3025..b3b4605e10e 100644 --- a/java/src/IceInternal/InvocationObserverI.java +++ b/java/src/IceInternal/InvocationObserverI.java @@ -90,18 +90,6 @@ public class InvocationObserverI extends IceMX.Observer<IceMX.InvocationMetrics> return _endpointInfo; } - public String - getEndpointEncodingVersion() - { - return Ice.Util.encodingVersionToString(getEndpointInfo().encoding); - } - - public String - getEndpointProtocolVersion() - { - return Ice.Util.protocolVersionToString(getEndpointInfo().protocol); - } - final private Ice.ConnectionInfo _connectionInfo; final private Ice.Endpoint _endpoint; private String _id; diff --git a/java/src/IceInternal/LocatorManager.java b/java/src/IceInternal/LocatorManager.java index 06e36c1cd26..843ee55ebf4 100644 --- a/java/src/IceInternal/LocatorManager.java +++ b/java/src/IceInternal/LocatorManager.java @@ -11,6 +11,60 @@ package IceInternal; public final class LocatorManager { + static private class LocatorKey implements Cloneable + { + public boolean + equals(Object o) + { + assert(o instanceof LocatorKey); + LocatorKey k = (LocatorKey)o; + if(!k._id.equals(_id)) + { + return false; + } + if(!k._encoding.equals(_encoding)) + { + return false; + } + return true; + } + + public int + hashCode() + { + int h = 5381; + h = IceInternal.HashUtil.hashAdd(h, _id); + h = IceInternal.HashUtil.hashAdd(h, _encoding); + return h; + } + + public java.lang.Object + clone() + { + java.lang.Object o = null; + try + { + o = super.clone(); + } + catch(CloneNotSupportedException ex) + { + assert false; // impossible + } + return o; + } + + LocatorKey set(Ice.LocatorPrx locator) + { + Reference r = ((Ice.ObjectPrxHelperBase)locator).__reference(); + _id = r.getIdentity(); + _encoding = r.getEncoding(); + return this; + } + + private Ice.Identity _id; + private Ice.EncodingVersion _encoding; + } + LocatorManager(Ice.Properties properties) { _background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0; @@ -58,11 +112,11 @@ public final class LocatorManager // have only one table per locator (not one per locator // proxy). // - LocatorTable table = _locatorTables.get(locator.ice_getIdentity()); + LocatorTable table = _locatorTables.get(_lookupKey.set(locator)); if(table == null) { table = new LocatorTable(); - _locatorTables.put(locator.ice_getIdentity(), table); + _locatorTables.put((LocatorKey)_lookupKey.clone(), table); } info = new LocatorInfo(locator, table, _background); @@ -77,6 +131,7 @@ public final class LocatorManager private java.util.HashMap<Ice.LocatorPrx, LocatorInfo> _table = new java.util.HashMap<Ice.LocatorPrx, LocatorInfo>(); - private java.util.HashMap<Ice.Identity, LocatorTable> _locatorTables = - new java.util.HashMap<Ice.Identity, LocatorTable>(); + private java.util.HashMap<LocatorKey, LocatorTable> _locatorTables = + new java.util.HashMap<LocatorKey, LocatorTable>(); + private LocatorKey _lookupKey = new LocatorKey(); // A key used for the lookup } diff --git a/java/src/IceInternal/OpaqueEndpointI.java b/java/src/IceInternal/OpaqueEndpointI.java index 3966d4ffe31..42a0d2da8b0 100644 --- a/java/src/IceInternal/OpaqueEndpointI.java +++ b/java/src/IceInternal/OpaqueEndpointI.java @@ -14,7 +14,7 @@ final class OpaqueEndpointI extends EndpointI public OpaqueEndpointI(String str) { - super(Protocol_0_0, Encoding_0_0, ""); + super(""); _rawEncoding = Protocol.currentEncoding; @@ -148,7 +148,7 @@ final class OpaqueEndpointI extends EndpointI public OpaqueEndpointI(short type, BasicStream s) { - super(Protocol_0_0, Encoding_0_0, ""); + super(""); _type = type; _rawEncoding = s.startReadEncaps(); int sz = s.getReadEncapsSize(); @@ -185,7 +185,7 @@ final class OpaqueEndpointI extends EndpointI public Ice.EndpointInfo getInfo() { - return new Ice.OpaqueEndpointInfo(_protocol, _encoding, -1, false, _rawEncoding, _rawBytes) + return new Ice.OpaqueEndpointInfo(-1, false, _rawEncoding, _rawBytes) { public short type() { @@ -453,7 +453,4 @@ final class OpaqueEndpointI extends EndpointI private Ice.EncodingVersion _rawEncoding; private byte[] _rawBytes; private int _hashCode; - - private final static Ice.ProtocolVersion Protocol_0_0 = new Ice.ProtocolVersion((byte)0, (byte)0); - private final static Ice.EncodingVersion Encoding_0_0 = new Ice.EncodingVersion((byte)0, (byte)0); } diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index f2d2b6317fe..fb857e8f865 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -26,6 +26,8 @@ public final class Outgoing implements OutgoingMessageCallback _encoding = handler.getReference().getEncoding(); _os = new BasicStream(_handler.getReference().getInstance(), Protocol.currentProtocolEncoding); + Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); + writeHeader(operation, mode, context); } @@ -44,6 +46,8 @@ public final class Outgoing implements OutgoingMessageCallback _observer = observer; _encoding = handler.getReference().getEncoding(); + Protocol.checkSupportedProtocol(_handler.getReference().getProtocol()); + writeHeader(operation, mode, context); } diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index 83166e27103..bfe52a0f49b 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -26,6 +26,8 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa _mode = mode; _sentSynchronously = false; + Protocol.checkSupportedProtocol(_proxy.__reference().getProtocol()); + if(explicitCtx && ctx == null) { ctx = _emptyContext; diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index 694aebea5d2..07dc9ac43b4 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Oct 22 18:48:40 2012 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Nov 12 21:17:34 2012 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -29,7 +29,6 @@ public final class PropertyNames new Property("Ice\\.Admin\\.Locator\\.LocatorCacheTimeout", false, null), new Property("Ice\\.Admin\\.Locator\\.Locator", false, null), new Property("Ice\\.Admin\\.Locator\\.Router", false, null), - new Property("Ice\\.Admin\\.Locator\\.EncodingVersion", false, null), new Property("Ice\\.Admin\\.Locator\\.CollocationOptimized", false, null), new Property("Ice\\.Admin\\.Locator", false, null), new Property("Ice\\.Admin\\.PublishedEndpoints", false, null), @@ -40,7 +39,6 @@ public final class PropertyNames new Property("Ice\\.Admin\\.Router\\.LocatorCacheTimeout", false, null), new Property("Ice\\.Admin\\.Router\\.Locator", false, null), new Property("Ice\\.Admin\\.Router\\.Router", false, null), - new Property("Ice\\.Admin\\.Router\\.EncodingVersion", false, null), new Property("Ice\\.Admin\\.Router\\.CollocationOptimized", false, null), new Property("Ice\\.Admin\\.Router", false, null), new Property("Ice\\.Admin\\.ProxyOptions", false, null), @@ -71,7 +69,6 @@ public final class PropertyNames new Property("Ice\\.Default\\.Locator\\.LocatorCacheTimeout", false, null), new Property("Ice\\.Default\\.Locator\\.Locator", false, null), new Property("Ice\\.Default\\.Locator\\.Router", false, null), - new Property("Ice\\.Default\\.Locator\\.EncodingVersion", false, null), new Property("Ice\\.Default\\.Locator\\.CollocationOptimized", false, null), new Property("Ice\\.Default\\.Locator", false, null), new Property("Ice\\.Default\\.LocatorCacheTimeout", false, null), @@ -84,7 +81,6 @@ public final class PropertyNames new Property("Ice\\.Default\\.Router\\.LocatorCacheTimeout", false, null), new Property("Ice\\.Default\\.Router\\.Locator", false, null), new Property("Ice\\.Default\\.Router\\.Router", false, null), - new Property("Ice\\.Default\\.Router\\.EncodingVersion", false, null), new Property("Ice\\.Default\\.Router\\.CollocationOptimized", false, null), new Property("Ice\\.Default\\.Router", false, null), new Property("Ice\\.Default\\.SlicedFormat", false, null), @@ -184,7 +180,6 @@ public final class PropertyNames new Property("IceBox\\.ServiceManager\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceBox\\.ServiceManager\\.Locator\\.Locator", false, null), new Property("IceBox\\.ServiceManager\\.Locator\\.Router", false, null), - new Property("IceBox\\.ServiceManager\\.Locator\\.EncodingVersion", false, null), new Property("IceBox\\.ServiceManager\\.Locator\\.CollocationOptimized", false, null), new Property("IceBox\\.ServiceManager\\.Locator", false, null), new Property("IceBox\\.ServiceManager\\.PublishedEndpoints", false, null), @@ -195,7 +190,6 @@ public final class PropertyNames new Property("IceBox\\.ServiceManager\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceBox\\.ServiceManager\\.Router\\.Locator", false, null), new Property("IceBox\\.ServiceManager\\.Router\\.Router", false, null), - new Property("IceBox\\.ServiceManager\\.Router\\.EncodingVersion", false, null), new Property("IceBox\\.ServiceManager\\.Router\\.CollocationOptimized", false, null), new Property("IceBox\\.ServiceManager\\.Router", false, null), new Property("IceBox\\.ServiceManager\\.ProxyOptions", false, null), @@ -219,7 +213,6 @@ public final class PropertyNames new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.LocatorCacheTimeout", false, null), new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.Locator", false, null), new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.Router", false, null), - new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.EncodingVersion", false, null), new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.CollocationOptimized", false, null), new Property("IceBoxAdmin\\.ServiceManager\\.Proxy", false, null), null @@ -248,7 +241,6 @@ public final class PropertyNames new Property("IceGrid\\.Node\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Node\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Node\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Node\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Node\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Node\\.Locator", false, null), new Property("IceGrid\\.Node\\.PublishedEndpoints", false, null), @@ -259,7 +251,6 @@ public final class PropertyNames new Property("IceGrid\\.Node\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Node\\.Router\\.Locator", false, null), new Property("IceGrid\\.Node\\.Router\\.Router", false, null), - new Property("IceGrid\\.Node\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Node\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Node\\.Router", false, null), new Property("IceGrid\\.Node\\.ProxyOptions", false, null), @@ -293,7 +284,6 @@ public final class PropertyNames new Property("IceGrid\\.Node\\.UserAccountMapper\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Node\\.UserAccountMapper\\.Locator", false, null), new Property("IceGrid\\.Node\\.UserAccountMapper\\.Router", false, null), - new Property("IceGrid\\.Node\\.UserAccountMapper\\.EncodingVersion", false, null), new Property("IceGrid\\.Node\\.UserAccountMapper\\.CollocationOptimized", false, null), new Property("IceGrid\\.Node\\.UserAccountMapper", false, null), new Property("IceGrid\\.Node\\.WaitTime", false, null), @@ -304,7 +294,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.Locator", false, null), new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.Router", false, null), - new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier", false, null), new Property("IceGrid\\.Registry\\.AdminSessionFilters", false, null), @@ -317,7 +306,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.PublishedEndpoints", false, null), @@ -328,7 +316,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.Locator", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.Router", false, null), - new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router", false, null), new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ProxyOptions", false, null), @@ -345,7 +332,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.Locator", false, null), new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.Router", false, null), - new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier", false, null), new Property("IceGrid\\.Registry\\.Client\\.ACM", false, null), @@ -357,7 +343,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Client\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Client\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Client\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Client\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Client\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Client\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Client\\.PublishedEndpoints", false, null), @@ -368,7 +353,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Client\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Client\\.Router\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Client\\.Router\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Client\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Client\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Client\\.Router", false, null), new Property("IceGrid\\.Registry\\.Client\\.ProxyOptions", false, null), @@ -392,7 +376,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Internal\\.PublishedEndpoints", false, null), @@ -403,7 +386,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Internal\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Router\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Router\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Internal\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Internal\\.Router", false, null), new Property("IceGrid\\.Registry\\.Internal\\.ProxyOptions", false, null), @@ -421,7 +403,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.Locator", false, null), new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.Router", false, null), - new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.PermissionsVerifier", false, null), new Property("IceGrid\\.Registry\\.ReplicaName", false, null), @@ -437,7 +418,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Server\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Server\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Server\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Server\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Server\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Server\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Server\\.PublishedEndpoints", false, null), @@ -448,7 +428,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Server\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.Server\\.Router\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Server\\.Router\\.Router", false, null), - new Property("IceGrid\\.Registry\\.Server\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.Server\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.Server\\.Router", false, null), new Property("IceGrid\\.Registry\\.Server\\.ProxyOptions", false, null), @@ -469,7 +448,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.Locator", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.Router", false, null), - new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Locator", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.PublishedEndpoints", false, null), @@ -480,7 +458,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.Locator", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.Router", false, null), - new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.Router", false, null), new Property("IceGrid\\.Registry\\.SessionManager\\.ProxyOptions", false, null), @@ -498,7 +475,6 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Locator", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Router", false, null), - new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.EncodingVersion", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null), new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null), @@ -535,7 +511,6 @@ public final class PropertyNames new Property("IcePatch2\\.Locator\\.LocatorCacheTimeout", false, null), new Property("IcePatch2\\.Locator\\.Locator", false, null), new Property("IcePatch2\\.Locator\\.Router", false, null), - new Property("IcePatch2\\.Locator\\.EncodingVersion", false, null), new Property("IcePatch2\\.Locator\\.CollocationOptimized", false, null), new Property("IcePatch2\\.Locator", false, null), new Property("IcePatch2\\.PublishedEndpoints", false, null), @@ -546,7 +521,6 @@ public final class PropertyNames new Property("IcePatch2\\.Router\\.LocatorCacheTimeout", false, null), new Property("IcePatch2\\.Router\\.Locator", false, null), new Property("IcePatch2\\.Router\\.Router", false, null), - new Property("IcePatch2\\.Router\\.EncodingVersion", false, null), new Property("IcePatch2\\.Router\\.CollocationOptimized", false, null), new Property("IcePatch2\\.Router", false, null), new Property("IcePatch2\\.ProxyOptions", false, null), @@ -630,7 +604,6 @@ public final class PropertyNames new Property("Glacier2\\.Client\\.Locator\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.Client\\.Locator\\.Locator", false, null), new Property("Glacier2\\.Client\\.Locator\\.Router", false, null), - new Property("Glacier2\\.Client\\.Locator\\.EncodingVersion", false, null), new Property("Glacier2\\.Client\\.Locator\\.CollocationOptimized", false, null), new Property("Glacier2\\.Client\\.Locator", false, null), new Property("Glacier2\\.Client\\.PublishedEndpoints", false, null), @@ -641,7 +614,6 @@ public final class PropertyNames new Property("Glacier2\\.Client\\.Router\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.Client\\.Router\\.Locator", false, null), new Property("Glacier2\\.Client\\.Router\\.Router", false, null), - new Property("Glacier2\\.Client\\.Router\\.EncodingVersion", false, null), new Property("Glacier2\\.Client\\.Router\\.CollocationOptimized", false, null), new Property("Glacier2\\.Client\\.Router", false, null), new Property("Glacier2\\.Client\\.ProxyOptions", false, null), @@ -674,7 +646,6 @@ public final class PropertyNames new Property("Glacier2\\.PermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.PermissionsVerifier\\.Locator", false, null), new Property("Glacier2\\.PermissionsVerifier\\.Router", false, null), - new Property("Glacier2\\.PermissionsVerifier\\.EncodingVersion", false, null), new Property("Glacier2\\.PermissionsVerifier\\.CollocationOptimized", false, null), new Property("Glacier2\\.PermissionsVerifier", false, null), new Property("Glacier2\\.ReturnClientProxy", false, null), @@ -684,7 +655,6 @@ public final class PropertyNames new Property("Glacier2\\.SSLPermissionsVerifier\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.SSLPermissionsVerifier\\.Locator", false, null), new Property("Glacier2\\.SSLPermissionsVerifier\\.Router", false, null), - new Property("Glacier2\\.SSLPermissionsVerifier\\.EncodingVersion", false, null), new Property("Glacier2\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null), new Property("Glacier2\\.SSLPermissionsVerifier", false, null), new Property("Glacier2\\.RoutingTable\\.MaxSize", false, null), @@ -697,7 +667,6 @@ public final class PropertyNames new Property("Glacier2\\.Server\\.Locator\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.Server\\.Locator\\.Locator", false, null), new Property("Glacier2\\.Server\\.Locator\\.Router", false, null), - new Property("Glacier2\\.Server\\.Locator\\.EncodingVersion", false, null), new Property("Glacier2\\.Server\\.Locator\\.CollocationOptimized", false, null), new Property("Glacier2\\.Server\\.Locator", false, null), new Property("Glacier2\\.Server\\.PublishedEndpoints", false, null), @@ -708,7 +677,6 @@ public final class PropertyNames new Property("Glacier2\\.Server\\.Router\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.Server\\.Router\\.Locator", false, null), new Property("Glacier2\\.Server\\.Router\\.Router", false, null), - new Property("Glacier2\\.Server\\.Router\\.EncodingVersion", false, null), new Property("Glacier2\\.Server\\.Router\\.CollocationOptimized", false, null), new Property("Glacier2\\.Server\\.Router", false, null), new Property("Glacier2\\.Server\\.ProxyOptions", false, null), @@ -731,7 +699,6 @@ public final class PropertyNames new Property("Glacier2\\.SessionManager\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.SessionManager\\.Locator", false, null), new Property("Glacier2\\.SessionManager\\.Router", false, null), - new Property("Glacier2\\.SessionManager\\.EncodingVersion", false, null), new Property("Glacier2\\.SessionManager\\.CollocationOptimized", false, null), new Property("Glacier2\\.SessionManager", false, null), new Property("Glacier2\\.SSLSessionManager\\.EndpointSelection", false, null), @@ -740,7 +707,6 @@ public final class PropertyNames new Property("Glacier2\\.SSLSessionManager\\.LocatorCacheTimeout", false, null), new Property("Glacier2\\.SSLSessionManager\\.Locator", false, null), new Property("Glacier2\\.SSLSessionManager\\.Router", false, null), - new Property("Glacier2\\.SSLSessionManager\\.EncodingVersion", false, null), new Property("Glacier2\\.SSLSessionManager\\.CollocationOptimized", false, null), new Property("Glacier2\\.SSLSessionManager", false, null), new Property("Glacier2\\.SessionTimeout", false, null), diff --git a/java/src/IceInternal/ProxyBatchOutgoingAsync.java b/java/src/IceInternal/ProxyBatchOutgoingAsync.java index 9d325d21d44..9e6a82b18b7 100644 --- a/java/src/IceInternal/ProxyBatchOutgoingAsync.java +++ b/java/src/IceInternal/ProxyBatchOutgoingAsync.java @@ -15,12 +15,14 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync { super(prx.ice_getCommunicator(), ((Ice.ObjectPrxHelperBase)prx).__reference().getInstance(), operation, callback); - _proxy = prx; + _proxy = (Ice.ObjectPrxHelperBase)prx; _observer = ObserverHelper.get(prx, operation); } public void __send() { + Protocol.checkSupportedProtocol(_proxy.__reference().getProtocol()); + // // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch // requests were queued with the connection, they would be lost without being noticed. @@ -29,7 +31,7 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync int cnt = -1; // Don't retry. try { - delegate = ((Ice.ObjectPrxHelperBase)_proxy).__getDelegate(false); + delegate = _proxy.__getDelegate(false); int status = delegate.__getRequestHandler().flushAsyncBatchRequests(this); if((status & AsyncStatus.Sent) > 0) { @@ -42,7 +44,7 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync } catch(Ice.LocalException __ex) { - cnt = ((Ice.ObjectPrxHelperBase)_proxy).__handleException(delegate, __ex, null, cnt, _observer); + cnt = _proxy.__handleException(delegate, __ex, null, cnt, _observer); } } @@ -52,5 +54,5 @@ public class ProxyBatchOutgoingAsync extends BatchOutgoingAsync return _proxy; } - private Ice.ObjectPrx _proxy; + private Ice.ObjectPrxHelperBase _proxy; } diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index 2e6e1f4af1a..b750743c252 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -36,6 +36,12 @@ public abstract class Reference implements Cloneable return _secure; } + public final Ice.ProtocolVersion + getProtocol() + { + return _protocol; + } + public final Ice.EncodingVersion getEncoding() { @@ -155,7 +161,7 @@ public abstract class Reference implements Cloneable return r; } - public final Reference + public Reference changeEncoding(Ice.EncodingVersion newEncoding) { if(newEncoding.equals(_encoding)) @@ -212,6 +218,7 @@ public abstract class Reference implements Cloneable { h = IceInternal.HashUtil.hashAdd(h, _compress); } + h = IceInternal.HashUtil.hashAdd(h, _protocol); h = IceInternal.HashUtil.hashAdd(h, _encoding); _hashValue = h; @@ -254,6 +261,12 @@ public abstract class Reference implements Cloneable s.writeBool(_secure); + if(!s.getWriteEncoding().equals(Ice.Util.Encoding_1_0)) + { + _protocol.__write(s); + _encoding.__write(s); + } + // Derived class writes the remainder of the reference. } @@ -348,6 +361,18 @@ public abstract class Reference implements Cloneable s.append(" -s"); } + if(!_protocol.equals(Ice.Util.Protocol_1_0)) + { + s.append(" -p "); + s.append(Ice.Util.protocolVersionToString(_protocol)); + } + + if(!_encoding.equals(Ice.Util.Encoding_1_0)) + { + s.append(" -e "); + s.append(Ice.Util.encodingVersionToString(_encoding)); + } + return s.toString(); // Derived class writes the remainder of the string. @@ -404,6 +429,11 @@ public abstract class Reference implements Cloneable return false; } + if(!_protocol.equals(r._protocol)) + { + return false; + } + if(!_encoding.equals(r._encoding)) { return false; @@ -440,6 +470,7 @@ public abstract class Reference implements Cloneable private Ice.Identity _identity; private java.util.Map<String, String> _context; private String _facet; + private Ice.ProtocolVersion _protocol; private Ice.EncodingVersion _encoding; protected boolean _overrideCompress; protected boolean _compress; // Only used if _overrideCompress == true @@ -451,6 +482,7 @@ public abstract class Reference implements Cloneable String facet, int mode, boolean secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding) { // @@ -467,6 +499,7 @@ public abstract class Reference implements Cloneable _identity = identity; _context = _emptyContext; _facet = facet; + _protocol = protocol; _encoding = encoding; _hashInitialized = false; _overrideCompress = false; diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 0d17f73b754..4ec3f1b9fba 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -19,7 +19,8 @@ public final class ReferenceFactory return null; } - return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), endpoints, null, null); + return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(), + endpoints, null, null); } public Reference @@ -30,7 +31,8 @@ public final class ReferenceFactory return null; } - return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), null, adapterId, null); + return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(), null, + adapterId, null); } public Reference @@ -41,8 +43,6 @@ public final class ReferenceFactory return null; } - DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - // // Create new reference // @@ -53,7 +53,7 @@ public final class ReferenceFactory "", // Facet fixedConnection.endpoint().datagram() ? Reference.ModeDatagram : Reference.ModeTwoway, fixedConnection.endpoint().secure(), - defaultsAndOverrides.defaultEncoding, + _instance.defaultsAndOverrides().defaultEncoding, fixedConnection); return updateCache(ref); } @@ -163,6 +163,7 @@ public final class ReferenceFactory String facet = ""; int mode = Reference.ModeTwoway; boolean secure = false; + Ice.EncodingVersion encoding = _instance.defaultsAndOverrides().defaultEncoding; String adapter = ""; while(true) @@ -336,6 +337,25 @@ public final class ReferenceFactory break; } + case 'e': + { + if(argument == null) + { + throw new Ice.ProxyParseException("no argument provided for -e option in `" + s + "'"); + } + + try + { + encoding = Ice.Util.stringToEncodingVersion(argument); + } + catch(Ice.VersionParseException e) + { + throw new Ice.ProxyParseException("invalid encoding version `" + argument + "' in `" + s + + "':\n" + e.str); + } + break; + } + default: { Ice.ProxyParseException e = new Ice.ProxyParseException(); @@ -347,7 +367,7 @@ public final class ReferenceFactory if(beg == -1) { - return create(ident, facet, mode, secure, null, null, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, null, null, propertyPrefix); } java.util.ArrayList<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); @@ -437,7 +457,7 @@ public final class ReferenceFactory EndpointI[] endp = new EndpointI[endpoints.size()]; endpoints.toArray(endp); - return create(ident, facet, mode, secure, endp, null, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, endp, null, propertyPrefix); } else if(s.charAt(beg) == '@') { @@ -496,7 +516,7 @@ public final class ReferenceFactory e.str = "empty adapter id in `" + s + "'"; throw e; } - return create(ident, facet, mode, secure, null, adapter, propertyPrefix); + return create(ident, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, null, adapter, propertyPrefix); } Ice.ProxyParseException ex = new Ice.ProxyParseException(); @@ -543,6 +563,21 @@ public final class ReferenceFactory boolean secure = s.readBool(); + Ice.ProtocolVersion protocol; + Ice.EncodingVersion encoding; + if(!s.getReadEncoding().equals(Ice.Util.Encoding_1_0)) + { + protocol = new Ice.ProtocolVersion(); + protocol.__read(s); + encoding = new Ice.EncodingVersion(); + encoding.__read(s); + } + else + { + protocol = Ice.Util.Protocol_1_0; + encoding = Ice.Util.Encoding_1_0; + } + EndpointI[] endpoints = null; String adapterId = null; @@ -560,7 +595,7 @@ public final class ReferenceFactory adapterId = s.readString(); } - return create(ident, facet, mode, secure, endpoints, adapterId, null); + return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, null); } public ReferenceFactory @@ -717,20 +752,31 @@ public final class ReferenceFactory } private Reference - create(Ice.Identity ident, String facet, int mode, boolean secure, EndpointI[] endpoints, String adapterId, - String propertyPrefix) + create(Ice.Identity ident, String facet, int mode, boolean secure, Ice.ProtocolVersion protocol, + Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, String propertyPrefix) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); // // Default local proxy options. // - LocatorInfo locatorInfo = _instance.locatorManager().get(_defaultLocator); + LocatorInfo locatorInfo = null; + if(_defaultLocator != null) + { + if(!((Ice.ObjectPrxHelperBase)_defaultLocator).__reference().getEncoding().equals(encoding)) + { + locatorInfo = _instance.locatorManager().get( + (Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding)); + } + else + { + locatorInfo = _instance.locatorManager().get(_defaultLocator); + } + } RouterInfo routerInfo = _instance.routerManager().get(_defaultRouter); boolean collocationOptimized = defaultsAndOverrides.defaultCollocationOptimization; boolean cacheConnection = true; boolean preferSecure = defaultsAndOverrides.defaultPreferSecure; - Ice.EncodingVersion encoding = defaultsAndOverrides.defaultEncoding; Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection; int locatorCacheTimeout = defaultsAndOverrides.defaultLocatorCacheTimeout; @@ -783,14 +829,6 @@ public final class ReferenceFactory property = propertyPrefix + ".PreferSecure"; preferSecure = properties.getPropertyAsIntWithDefault(property, preferSecure ? 1 : 0) > 0; - property = propertyPrefix + ".EncodingVersion"; - String encodingStr = properties.getProperty(property); - if(!encodingStr.isEmpty()) - { - encoding = Ice.Util.stringToEncodingVersion(encodingStr); - Protocol.checkSupportedEncoding(encoding); - } - property = propertyPrefix + ".EndpointSelection"; if(properties.getProperty(property).length() > 0) { @@ -823,6 +861,7 @@ public final class ReferenceFactory facet, mode, secure, + protocol, encoding, endpoints, adapterId, diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index 65933471a3d..98f3aacf236 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -72,6 +72,22 @@ public class RoutableReference extends Reference } public Reference + changeEncoding(Ice.EncodingVersion newEncoding) + { + RoutableReference r = (RoutableReference)super.changeEncoding(newEncoding); + if(r != this) + { + LocatorInfo locInfo = r._locatorInfo; + if(locInfo != null && !locInfo.getLocator().ice_getEncodingVersion().equals(newEncoding)) + { + r._locatorInfo = getInstance().locatorManager().get( + (Ice.LocatorPrx)locInfo.getLocator().ice_encodingVersion(newEncoding)); + } + } + return r; + } + + public Reference changeCompress(boolean newCompress) { RoutableReference r = (RoutableReference)super.changeCompress(newCompress); @@ -334,7 +350,6 @@ public class RoutableReference extends Reference properties.put(prefix + ".PreferSecure", _preferSecure ? "1" : "0"); properties.put(prefix + ".EndpointSelection", _endpointSelection == Ice.EndpointSelectionType.Random ? "Random" : "Ordered"); - properties.put(prefix + ".EncodingVersion", Ice.Util.encodingVersionToString(getEncoding())); StringBuffer s = new StringBuffer(); s.append(_locatorCacheTimeout); @@ -630,6 +645,7 @@ public class RoutableReference extends Reference String facet, int mode, boolean secure, + Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, @@ -641,7 +657,7 @@ public class RoutableReference extends Reference Ice.EndpointSelectionType endpointSelection, int locatorCacheTimeout) { - super(instance, communicator, identity, facet, mode, secure, encoding); + super(instance, communicator, identity, facet, mode, secure, protocol, encoding); _endpoints = endpoints; _adapterId = adapterId; _locatorInfo = locatorInfo; @@ -691,16 +707,13 @@ public class RoutableReference extends Reference java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); // - // Filter out incompatible endpoints (whose encoding/protocol - // versions aren't supported by this runtime, or are opaque). + // Filter out opaque endpoints. // - final Ice.EncodingVersion encoding = getEncoding(); - for(EndpointI p : allEndpoints) + for(EndpointI endpoint : allEndpoints) { - if(Protocol.isSupported(encoding, p.encodingVersion()) && - Protocol.isSupported(Protocol.currentProtocol, p.protocolVersion())) + if(!(endpoint instanceof IceInternal.OpaqueEndpointI)) { - endpoints.add(p); + endpoints.add(endpoint); } } diff --git a/java/src/IceInternal/TcpConnector.java b/java/src/IceInternal/TcpConnector.java index 71503101dc5..1f7bc747880 100644 --- a/java/src/IceInternal/TcpConnector.java +++ b/java/src/IceInternal/TcpConnector.java @@ -68,24 +68,19 @@ final class TcpConnector implements Connector // // Only for use by TcpEndpoint // - TcpConnector(Instance instance, java.net.InetSocketAddress addr, int timeout, Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, String connectionId) + TcpConnector(Instance instance, java.net.InetSocketAddress addr, int timeout, String connectionId) { _instance = instance; _traceLevels = instance.traceLevels(); _logger = instance.initializationData().logger; _addr = addr; _timeout = timeout; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getPort()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _timeout); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _protocol); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _encoding); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); } @@ -108,16 +103,6 @@ final class TcpConnector implements Connector return false; } - if(!_protocol.equals(p._protocol)) - { - return false; - } - - if(!_encoding.equals(p._encoding)) - { - return false; - } - if(!_connectionId.equals(p._connectionId)) { return false; @@ -131,8 +116,6 @@ final class TcpConnector implements Connector private Ice.Logger _logger; private java.net.InetSocketAddress _addr; private int _timeout; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private String _connectionId = ""; private int _hashCode; } diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index 960ffed5b38..64a4a4822f7 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -12,10 +12,9 @@ package IceInternal; final class TcpEndpointI extends EndpointI { public - TcpEndpointI(Instance instance, String ho, int po, int ti, Ice.ProtocolVersion pv, Ice.EncodingVersion ev, - String conId, boolean co) + TcpEndpointI(Instance instance, String ho, int po, int ti, String conId, boolean co) { - super(pv, ev, conId); + super(conId); _instance = instance; _host = ho; _port = po; @@ -27,7 +26,7 @@ final class TcpEndpointI extends EndpointI public TcpEndpointI(Instance instance, String str, boolean oaEndpoint) { - super(Protocol.currentProtocol, instance.defaultsAndOverrides().defaultEncoding, ""); + super(""); _instance = instance; _host = null; _port = 0; @@ -138,8 +137,7 @@ final class TcpEndpointI extends EndpointI default: { - parseOption(option, argument, "tcp", str); - break; + throw new Ice.EndpointParseException("unknown option `" + option + "' in `tcp " + str + "'"); } } } @@ -171,25 +169,13 @@ final class TcpEndpointI extends EndpointI public TcpEndpointI(BasicStream s) { - super(new Ice.ProtocolVersion(), new Ice.EncodingVersion(), ""); + super(""); _instance = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); - if(!s.getReadEncoding().equals(Ice.Util.Encoding_1_0)) - { - _protocol = new Ice.ProtocolVersion(); - _protocol.__read(s); - _encoding = new Ice.EncodingVersion(); - _encoding.__read(s); - } - else - { - _protocol = Ice.Util.Protocol_1_0; - _encoding = Ice.Util.Encoding_1_0; - } s.endReadEncaps(); calcHashValue(); } @@ -206,11 +192,6 @@ final class TcpEndpointI extends EndpointI s.writeInt(_port); s.writeInt(_timeout); s.writeBool(_compress); - if(!s.getWriteEncoding().equals(Ice.Util.Encoding_1_0)) - { - _protocol.__write(s); - _encoding.__write(s); - } s.endWriteEncaps(); } @@ -229,16 +210,6 @@ final class TcpEndpointI extends EndpointI // String s = "tcp"; - if(!_protocol.equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(_protocol); - } - - if(!_encoding.equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(_encoding); - } - if(_host != null && _host.length() > 0) { s += " -h "; @@ -273,7 +244,7 @@ final class TcpEndpointI extends EndpointI public Ice.EndpointInfo getInfo() { - return new Ice.TCPEndpointInfo(_protocol, _encoding, _timeout, _compress, _host, _port) + return new Ice.TCPEndpointInfo(_timeout, _compress, _host, _port) { public short type() { @@ -334,7 +305,7 @@ final class TcpEndpointI extends EndpointI } else { - return new TcpEndpointI(_instance, _host, _port, timeout, _protocol, _encoding, _connectionId, _compress); + return new TcpEndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } @@ -350,7 +321,7 @@ final class TcpEndpointI extends EndpointI } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, connectionId, _compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -378,7 +349,7 @@ final class TcpEndpointI extends EndpointI } else { - return new TcpEndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, _connectionId, compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } @@ -441,8 +412,7 @@ final class TcpEndpointI extends EndpointI acceptor(EndpointIHolder endpoint, String adapterName) { TcpAcceptor p = new TcpAcceptor(_instance, _host, _port); - endpoint.value = new TcpEndpointI(_instance, _host, p.effectivePort(), _timeout, _protocol, _encoding, - _connectionId, _compress); + endpoint.value = new TcpEndpointI(_instance, _host, p.effectivePort(), _timeout, _connectionId, _compress); return p; } @@ -463,8 +433,7 @@ final class TcpEndpointI extends EndpointI { for(String h : hosts) { - endps.add(new TcpEndpointI(_instance, h, _port, _timeout, _protocol, _encoding, _connectionId, - _compress)); + endps.add(new TcpEndpointI(_instance, h, _port, _timeout, _connectionId, _compress)); } } return endps; @@ -551,7 +520,7 @@ final class TcpEndpointI extends EndpointI java.util.List<Connector> connectors = new java.util.ArrayList<Connector>(); for(java.net.InetSocketAddress p : addresses) { - connectors.add(new TcpConnector(_instance, p, _timeout, _protocol, _encoding, _connectionId)); + connectors.add(new TcpConnector(_instance, p, _timeout, _connectionId)); } return connectors; } @@ -564,8 +533,6 @@ final class TcpEndpointI extends EndpointI h = IceInternal.HashUtil.hashAdd(h, _host); h = IceInternal.HashUtil.hashAdd(h, _port); h = IceInternal.HashUtil.hashAdd(h, _timeout); - h = IceInternal.HashUtil.hashAdd(h, _protocol); - h = IceInternal.HashUtil.hashAdd(h, _encoding); h = IceInternal.HashUtil.hashAdd(h, _connectionId); h = IceInternal.HashUtil.hashAdd(h, _compress); _hashCode = h; diff --git a/java/src/IceInternal/UdpConnector.java b/java/src/IceInternal/UdpConnector.java index 152e838dd58..3ca7d513080 100644 --- a/java/src/IceInternal/UdpConnector.java +++ b/java/src/IceInternal/UdpConnector.java @@ -46,22 +46,18 @@ final class UdpConnector implements Connector // Only for use by TcpEndpoint // UdpConnector(Instance instance, java.net.InetSocketAddress addr, String mcastInterface, int mcastTtl, - Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, String connectionId) + String connectionId) { _instance = instance; _addr = addr; _mcastInterface = mcastInterface; _mcastTtl = mcastTtl; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getPort()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _mcastInterface); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _protocol); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _encoding); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _mcastTtl); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); } @@ -85,16 +81,6 @@ final class UdpConnector implements Connector return false; } - if(!_protocol.equals(p._protocol)) - { - return false; - } - - if(!_encoding.equals(p._encoding)) - { - return false; - } - if(_mcastTtl != p._mcastTtl) { return false; @@ -112,8 +98,6 @@ final class UdpConnector implements Connector private java.net.InetSocketAddress _addr; private String _mcastInterface; private int _mcastTtl; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private String _connectionId; private int _hashCode; } diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java index b47d941bf15..2398fc43c98 100644 --- a/java/src/IceInternal/UdpEndpointI.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -12,10 +12,9 @@ package IceInternal; final class UdpEndpointI extends EndpointI { public - UdpEndpointI(Instance instance, String ho, int po, String mif, int mttl, Ice.ProtocolVersion p, - Ice.EncodingVersion e, boolean conn, String conId, boolean co) + UdpEndpointI(Instance instance, String ho, int po, String mif, int mttl, boolean conn, String conId, boolean co) { - super(p, e, conId); + super(conId); _instance = instance; _host = ho; _port = po; @@ -29,7 +28,7 @@ final class UdpEndpointI extends EndpointI public UdpEndpointI(Instance instance, String str, boolean oaEndpoint) { - super(Protocol.currentProtocol, instance.defaultsAndOverrides().defaultEncoding, ""); + super(""); _instance = instance; _host = null; _port = 0; @@ -120,6 +119,14 @@ final class UdpEndpointI extends EndpointI _compress = true; break; } + else if(option == "-v") + { + _instance.initializationData().logger.warning("deprecated udp endpoint option: -v"); + } + else if(option == "-e") + { + _instance.initializationData().logger.warning("deprecated udp endpoint option: -e"); + } else if(option.equals("--interface")) { if(argument == null) @@ -156,7 +163,7 @@ final class UdpEndpointI extends EndpointI } else { - parseOption(option, argument, "udp", str); + throw new Ice.EndpointParseException("unknown option `" + option + "' in `udp " + str + "'"); } } @@ -187,13 +194,18 @@ final class UdpEndpointI extends EndpointI public UdpEndpointI(BasicStream s) { - super(new Ice.ProtocolVersion(), new Ice.EncodingVersion(), ""); + super(""); _instance = s.instance(); s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); - _protocol.__read(s); - _encoding.__read(s); + if(s.getReadEncoding().equals(Ice.Util.Encoding_1_0)) + { + s.readByte(); + s.readByte(); + s.readByte(); + s.readByte(); + } // Not transmitted. //_connect = s.readBool(); _connect = false; @@ -212,8 +224,11 @@ final class UdpEndpointI extends EndpointI s.startWriteEncaps(); s.writeString(_host); s.writeInt(_port); - _protocol.__write(s); - _encoding.__write(s); + if(s.getWriteEncoding().equals(Ice.Util.Encoding_1_0)) + { + Ice.Util.Protocol_1_0.__write(s); + Ice.Util.Encoding_1_0.__write(s); + } // Not transmitted. //s.writeBool(_connect); s.writeBool(_compress); @@ -235,16 +250,6 @@ final class UdpEndpointI extends EndpointI // String s = "udp"; - if(!_protocol.equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(_protocol); - } - - if(!_encoding.equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(_encoding); - } - if(_host != null && _host.length() > 0) { s += " -h "; @@ -291,7 +296,7 @@ final class UdpEndpointI extends EndpointI public Ice.EndpointInfo getInfo() { - return new Ice.UDPEndpointInfo(_protocol, _encoding, -1, _compress, _host, _port, _mcastInterface, _mcastTtl) + return new Ice.UDPEndpointInfo(-1, _compress, _host, _port, _mcastInterface, _mcastTtl) { public short type() { @@ -362,8 +367,8 @@ final class UdpEndpointI extends EndpointI } else { - return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _protocol, _encoding, - _connect, _connectionId, compress); + return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, + compress); } } @@ -379,8 +384,8 @@ final class UdpEndpointI extends EndpointI } else { - return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _protocol, _encoding, - _connect, connectionId, _compress); + return new UdpEndpointI(_instance, _host, _port, _mcastInterface, _mcastTtl, _connect, connectionId, + _compress); } } @@ -425,7 +430,7 @@ final class UdpEndpointI extends EndpointI { UdpTransceiver p = new UdpTransceiver(_instance, _host, _port, _mcastInterface, _connect); endpoint.value = new UdpEndpointI(_instance, _host, p.effectivePort(), _mcastInterface, _mcastTtl, - _protocol, _encoding, _connect, _connectionId, _compress); + _connect, _connectionId, _compress); return p; } @@ -477,8 +482,8 @@ final class UdpEndpointI extends EndpointI { for(String host : hosts) { - endps.add(new UdpEndpointI(_instance, host, _port, _mcastInterface, _mcastTtl, - _protocol, _encoding, _connect, _connectionId, _compress)); + endps.add(new UdpEndpointI(_instance, host, _port, _mcastInterface, _mcastTtl, _connect, _connectionId, + _compress)); } } return endps; @@ -577,8 +582,7 @@ final class UdpEndpointI extends EndpointI java.util.ArrayList<Connector> connectors = new java.util.ArrayList<Connector>(); for(java.net.InetSocketAddress p : addresses) { - connectors.add(new UdpConnector(_instance, p, _mcastInterface, _mcastTtl, _protocol, _encoding, - _connectionId)); + connectors.add(new UdpConnector(_instance, p, _mcastInterface, _mcastTtl, _connectionId)); } return connectors; } @@ -593,8 +597,6 @@ final class UdpEndpointI extends EndpointI h = IceInternal.HashUtil.hashAdd(h, _mcastInterface); h = IceInternal.HashUtil.hashAdd(h, _mcastTtl); h = IceInternal.HashUtil.hashAdd(h, _connect); - h = IceInternal.HashUtil.hashAdd(h, _protocol); - h = IceInternal.HashUtil.hashAdd(h, _encoding); h = IceInternal.HashUtil.hashAdd(h, _connectionId); h = IceInternal.HashUtil.hashAdd(h, _compress); _hashCode = h; diff --git a/java/src/IceSSL/ConnectorI.java b/java/src/IceSSL/ConnectorI.java index 12db25b4f18..320640af36f 100644 --- a/java/src/IceSSL/ConnectorI.java +++ b/java/src/IceSSL/ConnectorI.java @@ -80,23 +80,19 @@ final class ConnectorI implements IceInternal.Connector // Only for use by EndpointI. // ConnectorI(Instance instance, String host, java.net.InetSocketAddress addr, int timeout, - Ice.ProtocolVersion protocol, Ice.EncodingVersion encoding, String connectionId) + String connectionId) { _instance = instance; _logger = instance.communicator().getLogger(); _host = host; _addr = addr; _timeout = timeout; - _protocol = protocol; - _encoding = encoding; _connectionId = connectionId; _hashCode = 5381; _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getPort()); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _timeout); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _protocol); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _encoding); _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); } @@ -119,16 +115,6 @@ final class ConnectorI implements IceInternal.Connector return false; } - if(!_protocol.equals(p._protocol)) - { - return false; - } - - if(!_encoding.equals(p._encoding)) - { - return false; - } - if(!_connectionId.equals(p._connectionId)) { return false; @@ -142,8 +128,6 @@ final class ConnectorI implements IceInternal.Connector private String _host; private java.net.InetSocketAddress _addr; private int _timeout; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; private String _connectionId; private int _hashCode; } diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java index 9a004a04d38..99c94fb7997 100644 --- a/java/src/IceSSL/EndpointI.java +++ b/java/src/IceSSL/EndpointI.java @@ -12,10 +12,9 @@ package IceSSL; final class EndpointI extends IceInternal.EndpointI { public - EndpointI(Instance instance, String ho, int po, int ti, Ice.ProtocolVersion pv, Ice.EncodingVersion ev, - String conId, boolean co) + EndpointI(Instance instance, String ho, int po, int ti, String conId, boolean co) { - super(pv, ev, conId); + super(conId); _instance = instance; _host = ho; _port = po; @@ -27,7 +26,7 @@ final class EndpointI extends IceInternal.EndpointI public EndpointI(Instance instance, String str, boolean oaEndpoint) { - super(IceInternal.Protocol.currentProtocol, instance.defaultEncoding(), ""); + super(""); _instance = instance; _host = null; _port = 0; @@ -138,7 +137,7 @@ final class EndpointI extends IceInternal.EndpointI default: { - parseOption(option, argument, "ssl", str); + throw new Ice.EndpointParseException("unknown option `" + option + "' in `ssl " + str + "'"); } } } @@ -170,23 +169,13 @@ final class EndpointI extends IceInternal.EndpointI public EndpointI(Instance instance, IceInternal.BasicStream s) { - super(new Ice.ProtocolVersion(), new Ice.EncodingVersion(), ""); + super(""); _instance = instance; s.startReadEncaps(); _host = s.readString(); _port = s.readInt(); _timeout = s.readInt(); _compress = s.readBool(); - if(!s.getReadEncoding().equals(Ice.Util.Encoding_1_0)) - { - _protocol.__read(s); - _encoding.__read(s); - } - else - { - _protocol = Ice.Util.Protocol_1_0; - _encoding = Ice.Util.Encoding_1_0; - } s.endReadEncaps(); calcHashValue(); } @@ -203,11 +192,6 @@ final class EndpointI extends IceInternal.EndpointI s.writeInt(_port); s.writeInt(_timeout); s.writeBool(_compress); - if(!s.getWriteEncoding().equals(Ice.Util.Encoding_1_0)) - { - _protocol.__write(s); - _encoding.__write(s); - } s.endWriteEncaps(); } @@ -226,16 +210,6 @@ final class EndpointI extends IceInternal.EndpointI // String s = "ssl"; - if(!_protocol.equals(Ice.Util.Protocol_1_0)) - { - s += " -v " + Ice.Util.protocolVersionToString(_protocol); - } - - if(!_encoding.equals(Ice.Util.Encoding_1_0)) - { - s += " -e " + Ice.Util.encodingVersionToString(_encoding); - } - if(_host != null && _host.length() > 0) { s += " -h "; @@ -270,7 +244,7 @@ final class EndpointI extends IceInternal.EndpointI public Ice.EndpointInfo getInfo() { - return new IceSSL.EndpointInfo(_protocol, _encoding, _timeout, _compress, _host, _port) + return new IceSSL.EndpointInfo(_timeout, _compress, _host, _port) { public short type() { @@ -331,7 +305,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(_instance, _host, _port, timeout, _protocol, _encoding, _connectionId, _compress); + return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress); } } @@ -347,7 +321,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, connectionId, _compress); + return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress); } } @@ -375,7 +349,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(_instance, _host, _port, _timeout, _protocol, _encoding, _connectionId, compress); + return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress); } } @@ -438,8 +412,7 @@ final class EndpointI extends IceInternal.EndpointI acceptor(IceInternal.EndpointIHolder endpoint, String adapterName) { AcceptorI p = new AcceptorI(_instance, adapterName, _host, _port); - endpoint.value = new EndpointI(_instance, _host, p.effectivePort(), _timeout, _protocol, _encoding, - _connectionId, _compress); + endpoint.value = new EndpointI(_instance, _host, p.effectivePort(), _timeout, _connectionId, _compress); return p; } @@ -461,8 +434,7 @@ final class EndpointI extends IceInternal.EndpointI { for(String host : hosts) { - endps.add(new EndpointI(_instance, host, _port, _timeout, _protocol, _encoding, _connectionId, - _compress)); + endps.add(new EndpointI(_instance, host, _port, _timeout, _connectionId, _compress)); } } return endps; @@ -549,7 +521,7 @@ final class EndpointI extends IceInternal.EndpointI java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>(); for(java.net.InetSocketAddress p : addresses) { - connectors.add(new ConnectorI(_instance, _host, p, _timeout, _protocol, _encoding, _connectionId)); + connectors.add(new ConnectorI(_instance, _host, p, _timeout, _connectionId)); } return connectors; } @@ -562,8 +534,6 @@ final class EndpointI extends IceInternal.EndpointI h = IceInternal.HashUtil.hashAdd(h, _host); h = IceInternal.HashUtil.hashAdd(h, _port); h = IceInternal.HashUtil.hashAdd(h, _timeout); - h = IceInternal.HashUtil.hashAdd(h, _protocol); - h = IceInternal.HashUtil.hashAdd(h, _encoding); h = IceInternal.HashUtil.hashAdd(h, _connectionId); h = IceInternal.HashUtil.hashAdd(h, _compress); _hashCode = h; diff --git a/java/test/Ice/info/AllTests.java b/java/test/Ice/info/AllTests.java index 6a0ac187232..c1697d26593 100644 --- a/java/test/Ice/info/AllTests.java +++ b/java/test/Ice/info/AllTests.java @@ -31,17 +31,14 @@ public class AllTests out.print("testing proxy endpoint information... "); out.flush(); { - Ice.ObjectPrx p1 = communicator.stringToProxy( - "test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + - "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + - "opaque -e 1.8 -t 100 -v ABCD"); + Ice.ObjectPrx p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + + "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + + "opaque -e 1.8 -t 100 -v ABCD"); Ice.Endpoint[] endps = p1.ice_getEndpoints(); Ice.IPEndpointInfo ipEndpoint = (Ice.IPEndpointInfo)endps[0].getInfo(); - test(ipEndpoint.protocol.equals(new Ice.ProtocolVersion((byte)1, (byte)4))); - test(ipEndpoint.encoding.equals(new Ice.EncodingVersion((byte)1, (byte)3))); test(ipEndpoint.host.equals("tcphost")); test(ipEndpoint.port == 10000); test(ipEndpoint.timeout == 1200); @@ -54,8 +51,6 @@ public class AllTests ipEndpoint.type() == IceSSL.EndpointType.value && ipEndpoint instanceof IceSSL.EndpointInfo); Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo(); - test(udpEndpoint.protocol.equals(Ice.Util.currentProtocol())); - test(udpEndpoint.encoding.equals(Ice.Util.currentEncoding())); test(udpEndpoint.host.equals("udphost")); test(udpEndpoint.port == 10001); test(udpEndpoint.mcastInterface.equals("eth0")); diff --git a/java/test/Ice/info/TestI.java b/java/test/Ice/info/TestI.java index bcbd30c26a1..7202711d2ce 100644 --- a/java/test/Ice/info/TestI.java +++ b/java/test/Ice/info/TestI.java @@ -38,10 +38,6 @@ public class TestI extends _TestIntfDisp if(ipinfo instanceof Ice.UDPEndpointInfo) { Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)ipinfo; - ctx.put("protocolMajor", Byte.toString(udp.protocol.major)); - ctx.put("protocolMinor", Byte.toString(udp.protocol.minor)); - ctx.put("encodingMajor", Byte.toString(udp.encoding.major)); - ctx.put("encodingMinor", Byte.toString(udp.encoding.minor)); ctx.put("mcastInterface", udp.mcastInterface); ctx.put("mcastTtl", Integer.toString(udp.mcastTtl)); } diff --git a/java/test/Ice/location/AllTests.java b/java/test/Ice/location/AllTests.java index 03da1abdcb8..2ccd9fd18a7 100644 --- a/java/test/Ice/location/AllTests.java +++ b/java/test/Ice/location/AllTests.java @@ -618,6 +618,18 @@ public class AllTests hello.sayHello(); out.println("ok"); + out.print("testing locator encoding resolution... "); + out.flush(); + hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); + count = locator.getRequestCount(); + communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Ice.Util.Encoding_1_1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test -e 1.0@TestAdapter10-2").ice_ping(); + test(++count == locator.getRequestCount()); + out.println("ok"); + out.print("shutdown server... "); out.flush(); obj.shutdown(); diff --git a/java/test/Ice/location/ServerLocator.java b/java/test/Ice/location/ServerLocator.java index 5770ee1c026..75eb7232b54 100644 --- a/java/test/Ice/location/ServerLocator.java +++ b/java/test/Ice/location/ServerLocator.java @@ -26,6 +26,13 @@ public class ServerLocator extends _TestLocatorDisp throws Ice.AdapterNotFoundException { ++_requestCount; + if(adapter.equals("TestAdapter10") || adapter.equals("TestAdapter10-2")) + { + assert(current.encoding.equals(Ice.Util.Encoding_1_0)); + response.ice_response(_registry.getAdapter("TestAdapter")); + return; + } + // We add a small delay to make sure locator request queuing gets tested when // running the test on a fast machine try diff --git a/java/test/Ice/metrics/AllTests.java b/java/test/Ice/metrics/AllTests.java index 8cdca5c451f..816cb07ad21 100644 --- a/java/test/Ice/metrics/AllTests.java +++ b/java/test/Ice/metrics/AllTests.java @@ -594,13 +594,11 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator", out); //testAttribute(clientMetrics, clientProps, update, "Connection", "id", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 500", out); + "tcp -h 127.0.0.1 -p 12010 -t 500", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", "1", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", "false", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointProtocolVersion", "1.0", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointEncodingVersion", "1.1", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out); @@ -661,17 +659,13 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010", c, out); + "tcp -h 127.0.0.1 -p 12010", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointProtocolVersion", "1.0", - c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointEncodingVersion", "1.1", - c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c, out); @@ -694,7 +688,7 @@ public class AllTests test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1); m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0]; - test(m1.current <= 1 && m1.total == 1 && m1.id.equals("tcp -e 1.1 -h localhost -p 12010")); + test(m1.current <= 1 && m1.total == 1 && m1.id.equals("tcp -h localhost -p 12010")); prx.ice_getConnection().close(false); @@ -712,27 +706,25 @@ public class AllTests } test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2); m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0]; - if(!m1.id.equals("tcp -e 1.1 -h unknownfoo.zeroc.com -p 12010")) + if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010")) { m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1]; } - test(m1.id.equals("tcp -e 1.1 -h unknownfoo.zeroc.com -p 12010") && m1.total == 2 && m1.failures == 2); + test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010") && m1.total == 2 && m1.failures == 2); checkFailure(clientMetrics, "EndpointLookup", m1.id, "Ice::DNSException", 2, out); c = new Connect(prx); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -e 1.1 -h localhost -p 12010", c, + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", - "tcp -e 1.1 -h localhost -p 12010", c, out); + "tcp -h localhost -p 12010", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", "false", c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointProtocolVersion", "1.0", c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointEncodingVersion", "1.1", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out); @@ -815,14 +807,12 @@ public class AllTests testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", - "tcp -e 1.1 -h 127.0.0.1 -p 12010", op, out); + "tcp -h 127.0.0.1 -p 12010", op, out); //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointProtocolVersion", "1.0", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointEncodingVersion", "1.1", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out); @@ -999,7 +989,7 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "id", - "metrics -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 [op]", op, out); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 [op]", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "operation", "op", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "identity", "metrics", op, out); @@ -1007,7 +997,7 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "Invocation", "encoding", "1.1", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "mode", "twoway", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "proxy", - "metrics -t:tcp -e 1.1 -h 127.0.0.1 -p 12010", op, out); + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry1", "test", op, out); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry2", "", op, out); diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java index 5cfce8e3455..0c60820319f 100644 --- a/java/test/Ice/proxy/AllTests.java +++ b/java/test/Ice/proxy/AllTests.java @@ -225,6 +225,14 @@ public class AllTests b1 = communicator.stringToProxy("test -s"); test(b1.ice_isSecure()); + test(b1.ice_getEncodingVersion().equals(Ice.Util.currentEncoding())); + + b1 = communicator.stringToProxy("test -e 1.0"); + test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0); + + b1 = communicator.stringToProxy("test -e 6.5"); + test(b1.ice_getEncodingVersion().major == 6 && b1.ice_getEncodingVersion().minor == 5); + try { b1 = communicator.stringToProxy("test:tcp@adapterId"); @@ -341,31 +349,6 @@ public class AllTests test(!b1.ice_isCollocationOptimized()); prop.setProperty(property, ""); - property = propertyPrefix + ".EncodingVersion"; - test(b1.ice_getEncodingVersion().equals(Ice.Util.currentEncoding())); - prop.setProperty(property, "1.0"); - b1 = communicator.propertyToProxy(propertyPrefix); - test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0); - prop.setProperty(property, "6.5"); - try - { - communicator.propertyToProxy(propertyPrefix); - test(false); - } - catch(Ice.UnsupportedEncodingException ex) - { - } - prop.setProperty(property, "1.2"); - try - { - communicator.propertyToProxy(propertyPrefix); - test(false); - } - catch(Ice.UnsupportedEncodingException ex) - { - } - prop.setProperty(property, ""); - out.println("ok"); out.print("testing proxyToProperty... "); @@ -397,43 +380,31 @@ public class AllTests b1 = b1.ice_locator(Ice.LocatorPrxHelper.uncheckedCast(locator)); java.util.Map<String, String> proxyProps = communicator.proxyToProperty(b1, "Test"); - test(proxyProps.size() == 21); + test(proxyProps.size() == 18); test(proxyProps.get("Test").equals("test -t")); - test(proxyProps.get("Test.EncodingVersion").equals("1.0")); test(proxyProps.get("Test.CollocationOptimized").equals("1")); test(proxyProps.get("Test.ConnectionCached").equals("1")); test(proxyProps.get("Test.PreferSecure").equals("0")); test(proxyProps.get("Test.EndpointSelection").equals("Ordered")); test(proxyProps.get("Test.LocatorCacheTimeout").equals("100")); - test(proxyProps.get("Test.Locator").equals("locator -t")); - test(proxyProps.get("Test.Locator.EncodingVersion").equals( - Ice.Util.encodingVersionToString(Ice.Util.currentEncoding()))); + test(proxyProps.get("Test.Locator").equals( + "locator -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding()))); test(proxyProps.get("Test.Locator.CollocationOptimized").equals("1")); test(proxyProps.get("Test.Locator.ConnectionCached").equals("0")); test(proxyProps.get("Test.Locator.PreferSecure").equals("1")); test(proxyProps.get("Test.Locator.EndpointSelection").equals("Random")); test(proxyProps.get("Test.Locator.LocatorCacheTimeout").equals("300")); - test(proxyProps.get("Test.Locator.Router").equals("router -t")); - test(proxyProps.get("Test.Locator.Router.EncodingVersion").equals( - Ice.Util.encodingVersionToString(Ice.Util.currentEncoding()))); + test(proxyProps.get("Test.Locator.Router").equals( + "router -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding()))); test(proxyProps.get("Test.Locator.Router.CollocationOptimized").equals("0")); test(proxyProps.get("Test.Locator.Router.ConnectionCached").equals("1")); test(proxyProps.get("Test.Locator.Router.PreferSecure").equals("1")); test(proxyProps.get("Test.Locator.Router.EndpointSelection").equals("Random")); test(proxyProps.get("Test.Locator.Router.LocatorCacheTimeout").equals("200")); - try - { - b1.ice_encodingVersion(new Ice.EncodingVersion((byte)3, (byte)4)); - test(false); - } - catch(Ice.UnsupportedEncodingException ex) - { - } - out.println("ok"); out.print("testing ice_getCommunicator... "); @@ -588,36 +559,73 @@ public class AllTests test(c.equals(c2)); out.println("ok"); + out.print("testing protocol versioning... "); + out.flush(); + { + Ice.OutputStream outS = Ice.Util.createOutputStream(communicator); + outS.writeProxy(cl); + byte[] inBytes = outS.finished(); + + // Protocol version 1.1 + inBytes[9] = 1; + inBytes[10] = 1; + + Ice.InputStream inS = Ice.Util.createInputStream(communicator, inBytes); + MyClassPrx cl11 = MyClassPrxHelper.uncheckedCast(inS.readProxy().ice_collocationOptimized(false)); + test(cl11.toString().equals("test -t -p 1.1 -e 1.1:tcp -h 127.0.0.1 -p 12010")); + try + { + cl11.ice_ping(); + test(false); + } + catch(Ice.UnsupportedProtocolException ex) + { + } + try + { + cl11.end_ice_ping(cl11.begin_ice_ping()); + test(false); + } + catch(Ice.UnsupportedProtocolException ex) + { + } + try + { + cl11.ice_flushBatchRequests(); + test(false); + } + catch(Ice.UnsupportedProtocolException ex) + { + } + try + { + cl11.end_ice_flushBatchRequests(cl11.begin_ice_flushBatchRequests()); + test(false); + } + catch(Ice.UnsupportedProtocolException ex) + { + } + } + out.println("ok"); + out.print("testing encoding versioning... "); out.flush(); - String ref20 = "test:default -p 12010 -e 2.0"; + String ref20 = "test -e 2.0:default -p 12010"; MyClassPrx cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { cl20.ice_collocationOptimized(false).ice_ping(); test(false); } - catch(Ice.NoEndpointException ex) + catch(Ice.UnsupportedEncodingException ex) { // Server 2.0 endpoint doesn't support 1.1 version. } - String ref10 = "test:default -p 12010 -e 1.0"; + String ref10 = "test -e 1.0:default -p 12010"; MyClassPrx cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); - try - { - cl10.ice_collocationOptimized(false).ice_ping(); // Can't send request with 1.1 encoding on 1.0 endpoint. - test(false); - } - catch(Ice.NoEndpointException ex) - { - // Server 1.0 endpoint doesn't support 1.1 version. - } - - // Server with 1.0 endpoint supports 1.0 encoding. + cl10.ice_ping(); cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - - // Server with 1.1 endpoint supports 1.0 encoding. cl.ice_collocationOptimized(false).ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); try @@ -776,17 +784,13 @@ public class AllTests } // Legal TCP endpoint expressed as opaque endpoint - Ice.ObjectPrx p1 = communicator.stringToProxy("test:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + Ice.ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); String pstr = communicator.proxyToString(p1); - test(pstr.equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000")); + test(pstr.equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000")); - // 1.1 TCP endpoint encoded with 1.1 encoding. - Ice.ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE="); - test(communicator.proxyToString(p2).equals("test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000")); - - // 1.0 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA="); - test(communicator.proxyToString(p2).equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000")); + // Opaque endpoint encoded with 1.1 encoding. + Ice.ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + test(communicator.proxyToString(p2).equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000")); if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0) { @@ -798,7 +802,7 @@ public class AllTests } // Two legal TCP endpoints expressed as opaque endpoints - p1 = communicator.stringToProxy("test:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); + p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); pstr = communicator.proxyToString(p1); test(pstr.equals("test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000")); @@ -806,7 +810,7 @@ public class AllTests // Test that an SSL endpoint and a nonsense endpoint get // written back out as an opaque endpoint. // - p1 = communicator.stringToProxy("test:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); + p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); pstr = communicator.proxyToString(p1); if(!ssl) { diff --git a/php/src/IcePHP/Endpoint.cpp b/php/src/IcePHP/Endpoint.cpp index a0f3829c010..417c7f475b6 100644 --- a/php/src/IcePHP/Endpoint.cpp +++ b/php/src/IcePHP/Endpoint.cpp @@ -286,10 +286,6 @@ IcePHP::endpointInit(TSRMLS_D) ce.create_object = handleEndpointInfoAlloc; endpointInfoClassEntry = zend_register_internal_class(&ce TSRMLS_CC); memcpy(&_endpointInfoHandlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - zend_declare_property_null(endpointInfoClassEntry, STRCAST("protocol"), sizeof("protocol") - 1, - ZEND_ACC_PUBLIC TSRMLS_CC); - zend_declare_property_null(endpointInfoClassEntry, STRCAST("encoding"), sizeof("encoding") - 1, - ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_long(endpointInfoClassEntry, STRCAST("timeout"), sizeof("timeout") - 1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_bool(endpointInfoClassEntry, STRCAST("compress"), sizeof("compress") - 1, 0, @@ -456,18 +452,6 @@ IcePHP::createEndpointInfo(zval* zv, const Ice::EndpointInfoPtr& p TSRMLS_DC) add_property_long(zv, STRCAST("port"), static_cast<long>(info->port)); } - zval* protocol; - MAKE_STD_ZVAL(protocol); - createProtocolVersion(protocol, p->protocol TSRMLS_CC); - add_property_zval(zv, STRCAST("protocol"), protocol); - zval_ptr_dtor(&protocol); // add_property_zval increased the refcount of protocol - - zval* encoding; - MAKE_STD_ZVAL(encoding); - createEncodingVersion(encoding, p->encoding TSRMLS_CC); - add_property_zval(zv, STRCAST("encoding"), encoding); - zval_ptr_dtor(&encoding); // add_property_zval increased the refcount of encoding - add_property_long(zv, STRCAST("timeout"), static_cast<long>(p->timeout)); add_property_bool(zv, STRCAST("compress"), static_cast<long>(p->compress)); diff --git a/php/test/Ice/info/Client.php b/php/test/Ice/info/Client.php index 4bded0b35b6..373bb6a0fc1 100644 --- a/php/test/Ice/info/Client.php +++ b/php/test/Ice/info/Client.php @@ -45,7 +45,7 @@ function allTests($communicator) echo "testing proxy endpoint information... "; flush(); { - $p1 = $communicator->stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" . + $p1 = $communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" . "udp -h udphost -p 10001 --interface eth0 --ttl 5:" . "opaque -e 1.8 -t 100 -v ABCD"); @@ -53,8 +53,6 @@ function allTests($communicator) $ipEndpoint = $endps[0]->getInfo(); test($ipEndpoint instanceof $ipEndpointInfoClass); - test($ipEndpoint->protocol == eval("return new " . $protocolVersionClass . "(1, 4);")); - test($ipEndpoint->encoding == eval("return new " . $encodingVersionClass . "(1, 3);")); test($ipEndpoint->host == "tcphost"); test($ipEndpoint->port == 10000); test($ipEndpoint->timeout == 1200); @@ -67,8 +65,6 @@ function allTests($communicator) $udpEndpoint = $endps[1]->getInfo(); test($udpEndpoint instanceof $udpEndpointInfoClass); - test($udpEndpoint->protocol == Ice_currentProtocol()); - test($udpEndpoint->encoding == Ice_currentEncoding()); test($udpEndpoint->host == "udphost"); test($udpEndpoint->port == 10001); test($udpEndpoint->mcastInterface == "eth0"); diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index b7f514e9ad2..aec97a2f4ee 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -371,42 +371,6 @@ function allTests($communicator) //test(!$b1->ice_isCollocationOptimized()); //$communicator->getProperties()->setProperty($property, ""); - $property = $propertyPrefix . ".EncodingVersion"; - test($b1->ice_getEncodingVersion() == Ice_currentEncoding()); - $communicator->getProperties()->setProperty($property, "1.0"); - $b1 = $communicator->propertyToProxy($propertyPrefix); - test($b1->ice_getEncodingVersion()->major == 1 && $b1->ice_getEncodingVersion()->minor == 0); - $communicator->getProperties()->setProperty($property, "6.5"); - try - { - $communicator->propertyToProxy($propertyPrefix); - test(false); - } - catch(Exception $ex) - { - $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; - if(!($ex instanceof $cls)) - { - throw $ex; - } - } - - $communicator->getProperties()->setProperty($property, "1.2"); - try - { - $communicator->propertyToProxy($propertyPrefix); - test(false); - } - catch(Exception $ex) - { - $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; - if(!($ex instanceof $cls)) - { - throw $ex; - } - } - $communicator->getProperties()->setProperty($property, ""); - echo "ok\n"; echo "testing proxyToProperty... "; @@ -438,46 +402,29 @@ function allTests($communicator) $b1 = $b1->ice_locator($locator->ice_uncheckedCast("::Ice::Locator")); $proxyProps = $communicator->proxyToProperty($b1, "Test"); - test(count($proxyProps) == 21); + test(count($proxyProps) == 18); test($proxyProps["Test"] == "test -t"); //test($proxyProps["Test.CollocationOptimized"] == "1"); - test($proxyProps["Test.EncodingVersion"] == "1.0"); test($proxyProps["Test.ConnectionCached"] == "1"); test($proxyProps["Test.PreferSecure"] == "0"); test($proxyProps["Test.EndpointSelection"] == "Ordered"); test($proxyProps["Test.LocatorCacheTimeout"] == "100"); - test($proxyProps["Test.Locator"] == "locator -t"); + test($proxyProps["Test.Locator"] == "locator -t -e " . Ice_encodingVersionToString(Ice_currentEncoding())); //test($proxyProps["Test.Locator.CollocationOptimized"] == "1"); - test($proxyProps["Test.Locator.EncodingVersion"] == Ice_encodingVersionToString(Ice_currentEncoding())); test($proxyProps["Test.Locator.ConnectionCached"] == "0"); test($proxyProps["Test.Locator.PreferSecure"] == "1"); test($proxyProps["Test.Locator.EndpointSelection"] == "Random"); test($proxyProps["Test.Locator.LocatorCacheTimeout"] == "300"); - test($proxyProps["Test.Locator.Router"] == "router -t"); + test($proxyProps["Test.Locator.Router"] == "router -t -e " . Ice_encodingVersionToString(Ice_currentEncoding())); //test($proxyProps["Test.Locator.Router.CollocationOptimized"] == "0"); - test($proxyProps["Test.Locator.Router.EncodingVersion"] == Ice_encodingVersionToString(Ice_currentEncoding())); test($proxyProps["Test.Locator.Router.ConnectionCached"] == "1"); test($proxyProps["Test.Locator.Router.PreferSecure"] == "1"); test($proxyProps["Test.Locator.Router.EndpointSelection"] == "Random"); test($proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200"); - try - { - $b1->ice_encodingVersion(eval("return new " . $encodingVersion . "(3, 4);")); - test(false); - } - catch(Exception $ex) - { - $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; - if(!($ex instanceof $cls)) - { - throw $ex; - } - } - echo "ok\n"; echo "testing ice_getCommunicator... "; @@ -531,6 +478,31 @@ function allTests($communicator) echo "ok\n"; + echo "testing encoding versioning... "; + flush(); + $ref20 = "test -e 2.0:default -p 12010"; + $cl20 = $communicator->stringToProxy($ref20)->ice_uncheckedCast("::Test::MyClass"); + try + { + $cl20->ice_ping(); + test(false); + } + catch(Exception $ex) + { + // Server 2.0 endpoint doesn't support 1.1 version. + $epe = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; + if(!($ex instanceof $epe)) + { + throw $ex; + } + } + $ref10 = "test -e 1.0:default -p 12010"; + $cl10 = $communicator->stringToProxy($ref10)->ice_uncheckedCast("::Test::MyClass"); + $cl10->ice_ping(); + $cl10->ice_encodingVersion($Ice_Encoding_1_0)->ice_ping(); + $cl->ice_encodingVersion($Ice_Encoding_1_0)->ice_ping(); + echo "ok\n"; + echo "testing opaque endpoints... "; flush(); @@ -700,17 +672,13 @@ function allTests($communicator) } // Legal TCP endpoint expressed as opaque endpoint. - $p1 = $communicator->stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + $p1 = $communicator->stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); $pstr = $communicator->proxyToString($p1); - test($pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); + test($pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); - // 1.1 TCP endpoint encoded with 1.1 encoding. - $p2 = $communicator->stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE="); - test($communicator->proxyToString($p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000"); - - // 1.0 TCP endpoint encoded with 1.1 encoding. - $p2 = $communicator->stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA="); - test($communicator->proxyToString($p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); + // Opaque endpoint encoded with 1.1 encoding. + $p2 = $communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + test($communicator->proxyToString($p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); // Working? if($communicator->getProperties()->getProperty("Ice.IPv6") == "" || @@ -723,7 +691,7 @@ function allTests($communicator) } // Two legal TCP endpoints expressed as opaque endpoints - $p1 = $communicator->stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); + $p1 = $communicator->stringToProxy("test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); $pstr = $communicator->proxyToString($p1); test($pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"); @@ -731,7 +699,7 @@ function allTests($communicator) // Test that an SSL endpoint and a nonsense endpoint get written // back out as an opaque endpoint. // - $p1 = $communicator->stringToProxy("test:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); + $p1 = $communicator->stringToProxy("test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); $pstr = $communicator->proxyToString($p1); if(!$ssl) { diff --git a/py/modules/IcePy/EndpointInfo.cpp b/py/modules/IcePy/EndpointInfo.cpp index 2af26990059..e98e57f54fc 100644 --- a/py/modules/IcePy/EndpointInfo.cpp +++ b/py/modules/IcePy/EndpointInfo.cpp @@ -123,24 +123,6 @@ endpointInfoSecure(EndpointInfoObject* self) extern "C" #endif static PyObject* -endpointInfoGetProtocol(EndpointInfoObject* self) -{ - return createProtocolVersion((*self->endpointInfo)->protocol); -} - -#ifdef WIN32 -extern "C" -#endif -static PyObject* -endpointInfoGetEncoding(EndpointInfoObject* self) -{ - return createEncodingVersion((*self->endpointInfo)->encoding); -} - -#ifdef WIN32 -extern "C" -#endif -static PyObject* endpointInfoGetTimeout(EndpointInfoObject* self) { return PyLong_FromLong((*self->endpointInfo)->timeout); @@ -242,10 +224,6 @@ static PyMethodDef EndpointInfoMethods[] = static PyGetSetDef EndpointInfoGetters[] = { - { STRCAST("protocol"), reinterpret_cast<getter>(endpointInfoGetProtocol), 0, - PyDoc_STR(STRCAST("protocol version supported by the endpoint")), 0 }, - { STRCAST("encoding"), reinterpret_cast<getter>(endpointInfoGetEncoding), 0, - PyDoc_STR(STRCAST("encoding version supported by the endpoint")), 0 }, { STRCAST("timeout"), reinterpret_cast<getter>(endpointInfoGetTimeout), 0, PyDoc_STR(STRCAST("timeout in milliseconds")), 0 }, { STRCAST("compress"), reinterpret_cast<getter>(endpointInfoGetCompress), 0, diff --git a/py/test/Ice/info/AllTests.py b/py/test/Ice/info/AllTests.py index 012e2f09416..429977876f5 100644 --- a/py/test/Ice/info/AllTests.py +++ b/py/test/Ice/info/AllTests.py @@ -17,7 +17,7 @@ def allTests(communicator, collocated): sys.stdout.write("testing proxy endpoint information... ") sys.stdout.flush() - p1 = communicator.stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + \ + p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + \ "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + \ "opaque -e 1.8 -t 100 -v ABCD") @@ -25,8 +25,6 @@ def allTests(communicator, collocated): ipEndpoint = endps[0].getInfo() test(isinstance(ipEndpoint, Ice.IPEndpointInfo)) - test(ipEndpoint.protocol == Ice.ProtocolVersion(1, 4)) - test(ipEndpoint.encoding == Ice.EncodingVersion(1, 3)) test(ipEndpoint.host == "tcphost") test(ipEndpoint.port == 10000) test(ipEndpoint.timeout == 1200) @@ -39,8 +37,6 @@ def allTests(communicator, collocated): udpEndpoint = endps[1].getInfo() test(isinstance(udpEndpoint, Ice.UDPEndpointInfo)) - test(udpEndpoint.protocol == Ice.currentProtocol()) - test(udpEndpoint.encoding == Ice.currentEncoding()) test(udpEndpoint.host == "udphost") test(udpEndpoint.port == 10001) test(udpEndpoint.mcastInterface == "eth0") diff --git a/py/test/Ice/proxy/AllTests.py b/py/test/Ice/proxy/AllTests.py index 7d8e684d22d..bda80313217 100644 --- a/py/test/Ice/proxy/AllTests.py +++ b/py/test/Ice/proxy/AllTests.py @@ -285,26 +285,6 @@ def allTests(communicator, collocated): #test(not b1.ice_isCollocationOptimized()) #prop.setProperty(property, "") - property = propertyPrefix + ".EncodingVersion" - test(b1.ice_getEncodingVersion() == Ice.currentEncoding()) - prop.setProperty(property, "1.0") - b1 = communicator.propertyToProxy(propertyPrefix) - test(b1.ice_getEncodingVersion().major == 1 and b1.ice_getEncodingVersion().minor == 0) - prop.setProperty(property, "6.5") - try: - communicator.propertyToProxy(propertyPrefix) - test(False) - except Ice.UnsupportedEncodingException: - pass - - prop.setProperty(property, "1.2") - try: - communicator.propertyToProxy(propertyPrefix) - test(False) - except Ice.UnsupportedEncodingException: - pass - prop.setProperty(property, "") - print("ok") sys.stdout.write("testing proxyToProperty... ") @@ -336,38 +316,29 @@ def allTests(communicator, collocated): b1 = b1.ice_locator(Ice.LocatorPrx.uncheckedCast(locator)) proxyProps = communicator.proxyToProperty(b1, "Test") - test(len(proxyProps) == 21) + test(len(proxyProps) == 18) test(proxyProps["Test"] == "test -t") #test(proxyProps["Test.CollocationOptimized"] == "1") - test(proxyProps["Test.EncodingVersion"] == "1.0") test(proxyProps["Test.ConnectionCached"] == "1") test(proxyProps["Test.PreferSecure"] == "0") test(proxyProps["Test.EndpointSelection"] == "Ordered") test(proxyProps["Test.LocatorCacheTimeout"] == "100") - test(proxyProps["Test.Locator"] == "locator -t") + test(proxyProps["Test.Locator"] == "locator -t -e " + Ice.encodingVersionToString(Ice.currentEncoding())) #test(proxyProps["Test.Locator.CollocationOptimized"] == "1") - test(proxyProps["Test.Locator.EncodingVersion"] == Ice.encodingVersionToString(Ice.currentEncoding())) test(proxyProps["Test.Locator.ConnectionCached"] == "0") test(proxyProps["Test.Locator.PreferSecure"] == "1") test(proxyProps["Test.Locator.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300") - test(proxyProps["Test.Locator.Router"] == "router -t") - test(proxyProps["Test.Locator.Router.EncodingVersion"] == Ice.encodingVersionToString(Ice.currentEncoding())) + test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice.encodingVersionToString(Ice.currentEncoding())) #test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0") test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1") test(proxyProps["Test.Locator.Router.PreferSecure"] == "1") test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200") - try: - b1.ice_encodingVersion(Ice.EncodingVersion(3, 4)) - test(False) - except Ice.UnsupportedEncodingException: - pass - print("ok") sys.stdout.write("testing ice_getCommunicator... ") @@ -582,6 +553,24 @@ def allTests(communicator, collocated): test(c == c2) print("ok") + sys.stdout.write("testing encoding versioning... ") + sys.stdout.flush() + ref20 = "test -e 2.0:default -p 12010"; + cl20 = Test.MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20)); + try: + cl20.ice_ping(); + test(false); + except Ice.UnsupportedEncodingException: + # Server 2.0 endpoint doesn't support 1.1 version. + pass + + ref10 = "test -e 1.0:default -p 12010"; + cl10 = Test.MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10)); + cl10.ice_ping(); + cl10.ice_encodingVersion(Ice.Encoding_1_0).ice_ping(); + cl.ice_encodingVersion(Ice.Encoding_1_0).ice_ping(); + print("ok") + sys.stdout.write("testing opaque endpoints... ") sys.stdout.flush() @@ -663,17 +652,13 @@ def allTests(communicator, collocated): pass # Legal TCP endpoint expressed as opaque endpoint - p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") + p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") pstr = communicator.proxyToString(p1) - test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000") - - # 1.1 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE=") - test(communicator.proxyToString(p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000") + test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") - # 1.0 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA=") - test(communicator.proxyToString(p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000") + # Opaque endpoint encoded with 1.1 encoding. + p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") + test(communicator.proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") if communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0: # Working? @@ -682,7 +667,7 @@ def allTests(communicator, collocated): p1.ice_encodingVersion(Ice.Encoding_1_0).ice_ping() # Two legal TCP endpoints expressed as opaque endpoints - p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") + p1 = communicator.stringToProxy("test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") pstr = communicator.proxyToString(p1) test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000") @@ -690,7 +675,7 @@ def allTests(communicator, collocated): # Test that an SSL endpoint and a nonsense endpoint get written # back out as an opaque endpoint. # - p1 = communicator.stringToProxy("test:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") + p1 = communicator.stringToProxy("test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") pstr = communicator.proxyToString(p1) if not ssl: test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") diff --git a/rb/config/Make.rules b/rb/config/Make.rules index 1691249b29e..4df95b0e3ff 100644 --- a/rb/config/Make.rules +++ b/rb/config/Make.rules @@ -166,7 +166,7 @@ LDFLAGS = $(LDPLATFORMFLAGS) $(CXXFLAGS) -L$(libdir) ifdef ice_src_dist ifeq ($(ice_cpp_dir), $(ice_dir)/cpp) ifeq ($(SLICEPARSERLIB),) - SLICEPARSERLIB = $(ice_cpp_dir)/lib/$(call mklibfilename,Slice,$(VERSION)) + #SLICEPARSERLIB = $(ice_cpp_dir)/lib/$(call mklibfilename,Slice,$(VERSION)) endif SLICE2RB = $(ice_cpp_dir)/bin/$(slice_translator) else diff --git a/rb/src/IceRuby/Endpoint.cpp b/rb/src/IceRuby/Endpoint.cpp index c9c149ce415..4b66421dd58 100644 --- a/rb/src/IceRuby/Endpoint.cpp +++ b/rb/src/IceRuby/Endpoint.cpp @@ -169,8 +169,6 @@ IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) { info = Data_Wrap_Struct(_endpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); } - rb_ivar_set(info, rb_intern("@protocol"), createProtocolVersion(p->protocol)); - rb_ivar_set(info, rb_intern("@encoding"), createEncodingVersion(p->encoding)); rb_ivar_set(info, rb_intern("@timeout"), INT2FIX(p->timeout)); rb_ivar_set(info, rb_intern("@compress"), p->compress ? Qtrue : Qfalse); return info; diff --git a/rb/test/Ice/info/AllTests.rb b/rb/test/Ice/info/AllTests.rb index 7aed5469f2f..ca14c32d1d3 100644 --- a/rb/test/Ice/info/AllTests.rb +++ b/rb/test/Ice/info/AllTests.rb @@ -11,7 +11,7 @@ def allTests(communicator) print "testing proxy endpoint information..." STDOUT.flush - p1 = communicator.stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" + \ + p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" + \ "udp -h udphost -p 10001 --interface eth0 --ttl 5:" + \ "opaque -e 1.8 -t 100 -v ABCD") @@ -19,8 +19,6 @@ def allTests(communicator) ipEndpoint = endps[0].getInfo() test(ipEndpoint.is_a?(Ice::IPEndpointInfo)); - test(ipEndpoint.protocol == Ice::ProtocolVersion.new(1, 4)) - test(ipEndpoint.encoding == Ice::EncodingVersion.new(1, 3)) test(ipEndpoint.host == "tcphost") test(ipEndpoint.port == 10000) test(ipEndpoint.timeout == 1200) @@ -33,8 +31,6 @@ def allTests(communicator) udpEndpoint = endps[1].getInfo() test(udpEndpoint.is_a?(Ice::UDPEndpointInfo)); - test(udpEndpoint.protocol == Ice::currentProtocol) - test(udpEndpoint.encoding == Ice::currentEncoding) test(udpEndpoint.host == "udphost") test(udpEndpoint.port == 10001) test(udpEndpoint.mcastInterface == "eth0") diff --git a/rb/test/Ice/proxy/AllTests.rb b/rb/test/Ice/proxy/AllTests.rb index e3709b26f6a..5f9505f6dd2 100644 --- a/rb/test/Ice/proxy/AllTests.rb +++ b/rb/test/Ice/proxy/AllTests.rb @@ -161,6 +161,14 @@ def allTests(communicator) b1 = communicator.stringToProxy("test -s") test(b1.ice_isSecure()) + test(b1.ice_getEncodingVersion() == Ice::currentEncoding()); + + b1 = communicator.stringToProxy("test -e 1.0"); + test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0); + + b1 = communicator.stringToProxy("test -e 6.5"); + test(b1.ice_getEncodingVersion().major == 6 && b1.ice_getEncodingVersion().minor == 5); + begin b1 = communicator.stringToProxy("test:tcp@adapterId") test(false) @@ -270,26 +278,6 @@ def allTests(communicator) #test(!b1.ice_isCollocationOptimized()) #prop.setProperty(property, "") - property = propertyPrefix + ".EncodingVersion" - test(b1.ice_getEncodingVersion() == Ice::currentEncoding()) - prop.setProperty(property, "1.0") - b1 = communicator.propertyToProxy(propertyPrefix) - test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0) - prop.setProperty(property, "6.5") - begin - communicator.propertyToProxy(propertyPrefix) - test(false) - rescue Ice::UnsupportedEncodingException - end - - prop.setProperty(property, "1.2") - begin - communicator.propertyToProxy(propertyPrefix) - test(false) - rescue Ice::UnsupportedEncodingException - end - prop.setProperty(property, "") - puts "ok" print "testing proxyToProperty... " @@ -321,38 +309,29 @@ def allTests(communicator) b1 = b1.ice_locator(Ice::LocatorPrx::uncheckedCast(locator)) proxyProps = communicator.proxyToProperty(b1, "Test") - test(proxyProps.length() == 21) + test(proxyProps.length() == 18) test(proxyProps["Test"] == "test -t") #test(proxyProps["Test.CollocationOptimized"] == "1") - test(proxyProps["Test.EncodingVersion"] == "1.0") test(proxyProps["Test.ConnectionCached"] == "1") test(proxyProps["Test.PreferSecure"] == "0") test(proxyProps["Test.EndpointSelection"] == "Ordered") test(proxyProps["Test.LocatorCacheTimeout"] == "100") - test(proxyProps["Test.Locator"] == "locator -t") + test(proxyProps["Test.Locator"] == "locator -t -e " + Ice::encodingVersionToString(Ice::currentEncoding())) #test(proxyProps["Test.Locator.CollocationOptimized"] == "1") - test(proxyProps["Test.Locator.EncodingVersion"] == Ice::encodingVersionToString(Ice::currentEncoding())) test(proxyProps["Test.Locator.ConnectionCached"] == "0") test(proxyProps["Test.Locator.PreferSecure"] == "1") test(proxyProps["Test.Locator.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300") - test(proxyProps["Test.Locator.Router"] == "router -t") + test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice::encodingVersionToString(Ice::currentEncoding())); #test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0") - test(proxyProps["Test.Locator.Router.EncodingVersion"] == Ice::encodingVersionToString(Ice::currentEncoding())) test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1") test(proxyProps["Test.Locator.Router.PreferSecure"] == "1") test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random") test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200") - begin - b1.ice_encodingVersion(Ice::EncodingVersion.new(3, 4)) - test(false) - rescue Ice::UnsupportedEncodingException - end - puts "ok" print "testing ice_getCommunicator... " @@ -562,6 +541,24 @@ def allTests(communicator) test(c == c2) puts "ok" + print "testing encoding versioning... " + STDOUT.flush + ref20 = "test -e 2.0:default -p 12010"; + cl20 = Test::MyClassPrx::uncheckedCast(communicator.stringToProxy(ref20)); + begin + cl20.ice_ping(); + test(false); + rescue Ice::UnsupportedEncodingException + # Server 2.0 endpoint doesn't support 1.1 version. + end + + ref10 = "test -e 1.0:default -p 12010"; + cl10 = Test::MyClassPrx::uncheckedCast(communicator.stringToProxy(ref10)); + cl10.ice_ping(); + cl10.ice_encodingVersion(Ice::Encoding_1_0).ice_ping(); + cl.ice_encodingVersion(Ice::Encoding_1_0).ice_ping(); + puts "ok" + print "testing opaque endpoints... " STDOUT.flush @@ -643,17 +640,13 @@ def allTests(communicator) end # Legal TCP endpoint expressed as opaque endpoint. - p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") + p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") pstr = communicator.proxyToString(p1) - test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000") - - # 1.1 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE=") - test(communicator.proxyToString(p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000") + test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") - # 1.0 TCP endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA=") - test(communicator.proxyToString(p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000") + # Opaque endpoint encoded with 1.1 encoding. + p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") + test(communicator.proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") # Working? if communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0 @@ -663,7 +656,7 @@ def allTests(communicator) end # Two legal TCP endpoints expressed as opaque endpoints - p1 = communicator.stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") + p1 = communicator.stringToProxy("test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") pstr = communicator.proxyToString(p1) test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000") @@ -671,7 +664,7 @@ def allTests(communicator) # Test that an SSL endpoint and a nonsense endpoint get written # back out as an opaque endpoint. # - p1 = communicator.stringToProxy("test:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") + p1 = communicator.stringToProxy("test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") pstr = communicator.proxyToString(p1) if !ssl test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index 2592c3ae55d..d3bf808d437 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -329,7 +329,7 @@ def run(tests, root = False): elif o == "--protocol": if a not in ( "ssl", "tcp"): usage() - if getDefaultMapping() == "cs" and a == "ssl": + if not root and getDefaultMapping() == "cs" and a == "ssl": if mono: print("SSL is not supported with mono") sys.exit(1) @@ -1455,6 +1455,7 @@ def getTestEnv(lang, testdir): addClasspath(os.path.join(javaDir, "IceStorm.jar"), env) addClasspath(os.path.join(javaDir, "IceGrid.jar"), env) addClasspath(os.path.join(javaDir, "IcePatch2.jar"), env) + addClasspath(os.path.join(javaDir), env) # # On Windows, C# assemblies are found thanks to the .exe.config files. diff --git a/slice/Glacier2/PermissionsVerifier.ice b/slice/Glacier2/PermissionsVerifier.ice index 32a059b36ad..2cd0fffc975 100644 --- a/slice/Glacier2/PermissionsVerifier.ice +++ b/slice/Glacier2/PermissionsVerifier.ice @@ -39,8 +39,7 @@ interface PermissionsVerifier * @return True if access is granted, or false otherwise. * **/ - ["nonmutating", "cpp:const"] idempotent bool checkPermissions(string userId, string password, - out string reason); + ["nonmutating", "cpp:const"] idempotent bool checkPermissions(string userId, string password, out string reason); }; /** diff --git a/slice/Ice/Endpoint.ice b/slice/Ice/Endpoint.ice index 1b82b6d6dae..78768f012f9 100644 --- a/slice/Ice/Endpoint.ice +++ b/slice/Ice/Endpoint.ice @@ -39,20 +39,6 @@ const short UDPEndpointType = 3; **/ local class EndpointInfo { - /** - * - * The protocol version supported by the endpoint. - * - **/ - ProtocolVersion protocol; - - /** - * - * The encoding version supported by the endpoint. - * - **/ - EncodingVersion encoding; - /** * * The timeout for the endpoint in milliseconds. 0 means |