summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2015-01-09 09:18:21 -0330
committerDwayne Boone <dwayne@zeroc.com>2015-01-09 09:18:21 -0330
commitd02b0603f1bd1b66b47673474bc167c65f619f93 (patch)
tree2176351e8b5a9452a1c453add92ebd77ee3dae16 /cpp/src
parentICE-6196 added ProtocolInstance::secure() (diff)
downloadice-d02b0603f1bd1b66b47673474bc167c65f619f93.tar.bz2
ice-d02b0603f1bd1b66b47673474bc167c65f619f93.tar.xz
ice-d02b0603f1bd1b66b47673474bc167c65f619f93.zip
ICE-6196 Fixes for ProtocolInstance::secure()
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp26
-rw-r--r--cpp/src/Ice/ProtocolInstance.cpp18
-rw-r--r--cpp/src/Ice/ProtocolInstance.h11
-rw-r--r--cpp/src/IceSSL/Instance.cpp2
-rw-r--r--cpp/src/IceSSL/PluginI.cpp9
5 files changed, 35 insertions, 31 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 73189d1972c..47de1ec9a20 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -195,7 +195,7 @@ class Timer : public IceUtil::Timer
{
public:
- Timer(int priority) :
+ Timer(int priority) :
IceUtil::Timer(priority),
_hasObserver(false)
{
@@ -1314,9 +1314,9 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_locatorManager = new LocatorManager(_initData.properties);
_referenceFactory = new ReferenceFactory(this, communicator);
-
+
_requestHandlerFactory = new RequestHandlerFactory(this);
-
+
_proxyFactory = new ProxyFactory(this);
const bool isIPv6Supported = IceInternal::isIPv6Supported();
@@ -1344,28 +1344,28 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_endpointFactoryManager = new EndpointFactoryManager(this);
#ifndef ICE_OS_WINRT
- ProtocolInstancePtr tcpProtocolInstance = new ProtocolInstance(this, TCPEndpointType, "tcp");
+ ProtocolInstancePtr tcpProtocolInstance = new ProtocolInstance(this, TCPEndpointType, "tcp", false);
EndpointFactoryPtr tcpEndpointFactory = new TcpEndpointFactory(tcpProtocolInstance);
_endpointFactoryManager->add(tcpEndpointFactory);
#else
- ProtocolInstancePtr tcpProtocolInstance = new ProtocolInstance(this, TCPEndpointType, "tcp");
+ ProtocolInstancePtr tcpProtocolInstance = new ProtocolInstance(this, TCPEndpointType, "tcp", false);
EndpointFactoryPtr tcpEndpointFactory = new StreamEndpointFactory(tcpProtocolInstance);
_endpointFactoryManager->add(tcpEndpointFactory);
- ProtocolInstancePtr sslProtocolInstance = new ProtocolInstance(this, IceSSL::EndpointType, "ssl");
+ ProtocolInstancePtr sslProtocolInstance = new ProtocolInstance(this, IceSSL::EndpointType, "ssl", true);
EndpointFactoryPtr sslEndpointFactory = new StreamEndpointFactory(sslProtocolInstance);
_endpointFactoryManager->add(sslEndpointFactory);
- ProtocolInstancePtr wssProtocolInstance = new ProtocolInstance(this, WSSEndpointType, "wss");
+ ProtocolInstancePtr wssProtocolInstance = new ProtocolInstance(this, WSSEndpointType, "wss", true);
EndpointFactoryPtr wssEndpointFactory = new WSEndpointFactory(wssProtocolInstance,
sslEndpointFactory->clone(wssProtocolInstance));
_endpointFactoryManager->add(wssEndpointFactory);
#endif
- ProtocolInstancePtr udpProtocolInstance = new ProtocolInstance(this, UDPEndpointType, "udp");
+ ProtocolInstancePtr udpProtocolInstance = new ProtocolInstance(this, UDPEndpointType, "udp", false);
EndpointFactoryPtr udpEndpointFactory = new UdpEndpointFactory(udpProtocolInstance);
_endpointFactoryManager->add(udpEndpointFactory);
- ProtocolInstancePtr wsProtocolInstance = new ProtocolInstance(this, WSEndpointType, "ws");
+ ProtocolInstancePtr wsProtocolInstance = new ProtocolInstance(this, WSEndpointType, "ws", false);
EndpointFactoryPtr wsEndpointFactory = new WSEndpointFactory(wsProtocolInstance,
tcpEndpointFactory->clone(wsProtocolInstance));
@@ -1390,7 +1390,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
{
_wstringConverter = new IceUtil::UnicodeWstringConverter;
}
-
+
__setNoDelete(false);
}
catch(...)
@@ -1473,7 +1473,7 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[], const Ice::Communica
{
_wstringConverter = new IceUtil::UnicodeWstringConverter;
}
-
+
//
// Create Admin facets, if enabled.
//
@@ -1746,7 +1746,7 @@ IceInternal::Instance::destroy()
// Now, destroy the thread pools. This must be done *only* after
// all the connections are finished (the connections destruction
// can require invoking callbacks with the thread pools).
- //
+ //
if(_serverThreadPool)
{
_serverThreadPool->destroy();
@@ -1781,7 +1781,7 @@ IceInternal::Instance::destroy()
_endpointHostResolver->getThreadControl().join();
}
#endif
-
+
if(_servantFactoryManager)
{
_servantFactoryManager->destroy();
diff --git a/cpp/src/Ice/ProtocolInstance.cpp b/cpp/src/Ice/ProtocolInstance.cpp
index c7f17a3d9c3..a376873af05 100644
--- a/cpp/src/Ice/ProtocolInstance.cpp
+++ b/cpp/src/Ice/ProtocolInstance.cpp
@@ -22,33 +22,31 @@ using namespace IceInternal;
IceUtil::Shared* IceInternal::upCast(ProtocolInstance* p) { return p; }
-IceInternal::ProtocolInstance::ProtocolInstance(const CommunicatorPtr& com, Short type, const string& protocol) :
+IceInternal::ProtocolInstance::ProtocolInstance(const CommunicatorPtr& com, Short type, const string& protocol,
+ bool secure) :
_instance(getInstance(com)),
_traceLevel(_instance->traceLevels()->network),
_traceCategory(_instance->traceLevels()->networkCat),
_properties(_instance->initializationData().properties),
_protocol(protocol),
- _type(type)
+ _type(type),
+ _secure(secure)
{
}
-IceInternal::ProtocolInstance::ProtocolInstance(const InstancePtr& instance, Short type, const string& protocol) :
+IceInternal::ProtocolInstance::ProtocolInstance(const InstancePtr& instance, Short type, const string& protocol,
+ bool secure) :
_instance(instance),
_traceLevel(_instance->traceLevels()->network),
_traceCategory(_instance->traceLevels()->networkCat),
_properties(_instance->initializationData().properties),
_protocol(protocol),
- _type(type)
+ _type(type),
+ _secure(secure)
{
}
bool
-IceInternal::ProtocolInstance::secure() const
-{
- return _type == IceSSL::EndpointType || _type == WSSEndpointType;
-}
-
-bool
IceInternal::ProtocolInstance::preferIPv6() const
{
return _instance->preferIPv6();
diff --git a/cpp/src/Ice/ProtocolInstance.h b/cpp/src/Ice/ProtocolInstance.h
index 3255f26f022..6500b09b52a 100644
--- a/cpp/src/Ice/ProtocolInstance.h
+++ b/cpp/src/Ice/ProtocolInstance.h
@@ -27,7 +27,7 @@ class ICE_API ProtocolInstance : public IceUtil::Shared
{
public:
- ProtocolInstance(const Ice::CommunicatorPtr&, Ice::Short, const std::string&);
+ ProtocolInstance(const Ice::CommunicatorPtr&, Ice::Short, const std::string&, bool);
int traceLevel() const
{
@@ -59,7 +59,11 @@ public:
return _properties;
}
- bool secure() const;
+ bool secure() const
+ {
+ return _secure;
+ }
+
bool preferIPv6() const;
ProtocolSupport protocolSupport() const;
const std::string& defaultHost() const;
@@ -74,7 +78,7 @@ public:
private:
- ProtocolInstance(const InstancePtr&, Ice::Short, const std::string&);
+ ProtocolInstance(const InstancePtr&, Ice::Short, const std::string&, bool);
friend class Instance;
const InstancePtr _instance;
@@ -85,6 +89,7 @@ protected:
const Ice::PropertiesPtr _properties;
const std::string _protocol;
const Ice::Short _type;
+ const bool _secure;
};
}
diff --git a/cpp/src/IceSSL/Instance.cpp b/cpp/src/IceSSL/Instance.cpp
index c838566c942..d0380348f8d 100644
--- a/cpp/src/IceSSL/Instance.cpp
+++ b/cpp/src/IceSSL/Instance.cpp
@@ -22,7 +22,7 @@ using namespace IceSSL;
IceUtil::Shared* IceSSL::upCast(IceSSL::Instance* p) { return p; }
IceSSL::Instance::Instance(const SSLEnginePtr& engine, Short type, const string& protocol) :
- ProtocolInstance(engine->communicator(), type, protocol),
+ ProtocolInstance(engine->communicator(), type, protocol, true),
_engine(engine)
{
}
diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp
index 5f35b0780d1..021f4007071 100644
--- a/cpp/src/IceSSL/PluginI.cpp
+++ b/cpp/src/IceSSL/PluginI.cpp
@@ -47,9 +47,9 @@ IceSSL::PluginI::PluginI(const Ice::CommunicatorPtr& communicator)
#else
_engine = new OpenSSLEngine(communicator);
#endif
-
+
IceInternal::ProtocolPluginFacadePtr facade = IceInternal::getProtocolPluginFacade(communicator);
-
+
//
// Register the endpoint factory. We have to do this now, rather
// than in initialize, because the communicator may need to
@@ -57,8 +57,9 @@ IceSSL::PluginI::PluginI(const Ice::CommunicatorPtr& communicator)
//
IceInternal::EndpointFactoryPtr sslFactory = new EndpointFactoryI(new Instance(_engine, EndpointType, "ssl"));
facade->addEndpointFactory(sslFactory);
-
- IceInternal::ProtocolInstancePtr wss = new IceInternal::ProtocolInstance(communicator, WSSEndpointType, "wss");
+
+ IceInternal::ProtocolInstancePtr wss =
+ new IceInternal::ProtocolInstance(communicator, WSSEndpointType, "wss", true);
facade->addEndpointFactory(new IceInternal::WSEndpointFactory(wss, sslFactory->clone(wss)));
}