summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-04-10 19:33:17 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-04-10 19:33:17 +0200
commit1fa97b799b91fa6b0842e3267fec3d6e3a240df5 (patch)
tree1bc3abfddbcb66b51c776da15e2d88586ca2bbf4 /cpp
parentFix (ICE-7771) - UWP build fails, missing targets file (diff)
downloadice-1fa97b799b91fa6b0842e3267fec3d6e3a240df5.tar.bz2
ice-1fa97b799b91fa6b0842e3267fec3d6e3a240df5.tar.xz
ice-1fa97b799b91fa6b0842e3267fec3d6e3a240df5.zip
Fixed ICE-7755 - listen on all IPs associated with a DNS name
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp19
-rw-r--r--cpp/src/Ice/ConnectionFactory.h5
-rw-r--r--cpp/src/Ice/EndpointI.h15
-rw-r--r--cpp/src/Ice/IPEndpointI.cpp62
-rw-r--r--cpp/src/Ice/IPEndpointI.h3
-rwxr-xr-xcpp/src/Ice/Network.cpp3
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp33
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.cpp10
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.h3
-rw-r--r--cpp/src/Ice/WSEndpoint.cpp39
-rw-r--r--cpp/src/Ice/WSEndpoint.h4
-rw-r--r--cpp/src/IceBT/EndpointI.cpp13
-rw-r--r--cpp/src/IceBT/EndpointI.h3
-rw-r--r--cpp/src/IceIAP/EndpointI.h4
-rw-r--r--cpp/src/IceIAP/EndpointI.mm10
-rw-r--r--cpp/src/IceSSL/EndpointI.cpp39
-rw-r--r--cpp/src/IceSSL/EndpointI.h4
-rw-r--r--cpp/test/Ice/background/EndpointI.cpp19
-rw-r--r--cpp/test/Ice/background/EndpointI.h4
19 files changed, 254 insertions, 38 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 51f2c58cfb7..0858c97a556 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -1255,10 +1255,25 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
}
}
+bool
+IceInternal::IncomingConnectionFactory::isLocal(const EndpointIPtr& endpoint) const
+{
+ if(_publishedEndpoint && endpoint->equivalent(_publishedEndpoint))
+ {
+ return true;
+ }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ return endpoint->equivalent(_endpoint);
+}
+
EndpointIPtr
IceInternal::IncomingConnectionFactory::endpoint() const
{
- // No mutex protection necessary, _endpoint is immutable.
+ if(_publishedEndpoint)
+ {
+ return _publishedEndpoint;
+ }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
return _endpoint;
}
@@ -1561,10 +1576,12 @@ IceInternal::IncomingConnectionFactory::connectionStartFailed(const Ice::Connect
//
IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const InstancePtr& instance,
const EndpointIPtr& endpoint,
+ const EndpointIPtr& publishedEndpoint,
const ObjectAdapterIPtr& adapter) :
_instance(instance),
_monitor(new FactoryACMMonitor(instance, dynamic_cast<ObjectAdapterI*>(adapter.get())->getACM())),
_endpoint(endpoint),
+ _publishedEndpoint(publishedEndpoint),
_acceptorStarted(false),
_acceptorStopped(false),
_adapter(adapter),
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index 2bc809c1fca..13b41cabd17 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -189,6 +189,7 @@ public:
void waitUntilHolding() const;
void waitUntilFinished();
+ bool isLocal(const EndpointIPtr&) const;
EndpointIPtr endpoint() const;
std::list<Ice::ConnectionIPtr> connections() const;
void flushAsyncBatchRequests(const CommunicatorFlushBatchAsyncPtr&, Ice::CompressBatch);
@@ -210,7 +211,8 @@ public:
virtual void connectionStartCompleted(const Ice::ConnectionIPtr&);
virtual void connectionStartFailed(const Ice::ConnectionIPtr&, const Ice::LocalException&);
- IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const Ice::ObjectAdapterIPtr&);
+ IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const EndpointIPtr&,
+ const Ice::ObjectAdapterIPtr&);
void initialize();
virtual ~IncomingConnectionFactory();
@@ -244,6 +246,7 @@ private:
AcceptorPtr _acceptor;
const TransceiverPtr _transceiver;
EndpointIPtr _endpoint;
+ EndpointIPtr _publishedEndpoint;
bool _acceptorStarted;
bool _acceptorStopped;
diff --git a/cpp/src/Ice/EndpointI.h b/cpp/src/Ice/EndpointI.h
index 5cb10fc1040..8ff79a80b3a 100644
--- a/cpp/src/Ice/EndpointI.h
+++ b/cpp/src/Ice/EndpointI.h
@@ -128,10 +128,21 @@ public:
virtual AcceptorPtr acceptor(const std::string&) const = 0;
//
- // Expand endpoint out in to separate endpoints for each local
+ // Expand endpoint out into separate endpoints for each local
// host if listening on INADDR_ANY on server side.
//
- virtual std::vector<EndpointIPtr> expand() const = 0;
+ virtual std::vector<EndpointIPtr> expandIfWildcard() const = 0;
+
+ //
+ // Expand endpoint out into separate endpoints for each IP
+ // address returned by the DNS resolver. Also returns the
+ // endpoint which can be used to connect to the returned
+ // endpoints or null if no specific endpoint can be used to
+ // connect to these endpoints (e.g.: with the IP endpoint,
+ // it returns this endpoint if it uses a fixed port, null
+ // otherwise).
+ //
+ virtual std::vector<EndpointIPtr> expandHost(IceInternal::EndpointIPtr&) const = 0;
//
// Check whether the endpoint is equivalent to another one.
diff --git a/cpp/src/Ice/IPEndpointI.cpp b/cpp/src/Ice/IPEndpointI.cpp
index 86ffd787ec2..476fc3b809c 100644
--- a/cpp/src/Ice/IPEndpointI.cpp
+++ b/cpp/src/Ice/IPEndpointI.cpp
@@ -138,7 +138,7 @@ IceInternal::IPEndpointI::connectors_async(Ice::EndpointSelectionType selType, c
}
vector<EndpointIPtr>
-IceInternal::IPEndpointI::expand() const
+IceInternal::IPEndpointI::expandIfWildcard() const
{
vector<EndpointIPtr> endps;
vector<string> hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport(), false);
@@ -156,6 +156,55 @@ IceInternal::IPEndpointI::expand() const
return endps;
}
+vector<EndpointIPtr>
+IceInternal::IPEndpointI::expandHost(EndpointIPtr& publish) const
+{
+ //
+ // If this endpoint has an empty host (wildcard address), don't expand, just return
+ // this endpoint.
+ //
+ if(_host.empty())
+ {
+ vector<EndpointIPtr> endpoints;
+ endpoints.push_back(ICE_SHARED_FROM_CONST_THIS(IPEndpointI));
+ return endpoints;
+ }
+
+ //
+ // If using a fixed port, this endpoint can be used as the published endpoint to
+ // access the returned endpoints. Otherwise, we'll publish each individual expanded
+ // endpoint.
+ //
+ if(_port > 0)
+ {
+ publish = ICE_SHARED_FROM_CONST_THIS(IPEndpointI);
+ }
+
+ vector<Address> addrs = getAddresses(_host,
+ _port,
+ _instance->protocolSupport(),
+ Ice::ICE_ENUM(EndpointSelectionType, Ordered),
+ _instance->preferIPv6(),
+ true);
+
+ vector<EndpointIPtr> endpoints;
+ if(addrs.size() == 1)
+ {
+ endpoints.push_back(ICE_SHARED_FROM_CONST_THIS(IPEndpointI));
+ }
+ else
+ {
+ for(vector<Address>::const_iterator p = addrs.begin(); p != addrs.end(); ++p)
+ {
+ string host;
+ int port;
+ addrToAddressAndPort(*p, host, port);
+ endpoints.push_back(createEndpoint(host, port, _connectionId));
+ }
+ }
+ return endpoints;
+}
+
bool
IceInternal::IPEndpointI::equivalent(const EndpointIPtr& endpoint) const
{
@@ -634,7 +683,8 @@ IceInternal::EndpointHostResolver::run()
if(threadObserver)
{
- threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther), ICE_ENUM(ThreadState, ThreadStateIdle));
+ threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther),
+ ICE_ENUM(ThreadState, ThreadStateIdle));
}
}
@@ -642,7 +692,8 @@ IceInternal::EndpointHostResolver::run()
{
if(threadObserver)
{
- threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther), ICE_ENUM(ThreadState, ThreadStateIdle));
+ threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther),
+ ICE_ENUM(ThreadState, ThreadStateIdle));
}
if(r.observer)
{
@@ -678,7 +729,10 @@ IceInternal::EndpointHostResolver::updateObserver()
const CommunicatorObserverPtr& obsv = _instance->initializationData().observer;
if(obsv)
{
- _observer.attach(obsv->getThreadObserver("Communicator", name(), ICE_ENUM(ThreadState, ThreadStateIdle), _observer.get()));
+ _observer.attach(obsv->getThreadObserver("Communicator",
+ name(),
+ ICE_ENUM(ThreadState, ThreadStateIdle),
+ _observer.get()));
}
}
diff --git a/cpp/src/Ice/IPEndpointI.h b/cpp/src/Ice/IPEndpointI.h
index 4f51e5a9ff7..bfe1c6f97ec 100644
--- a/cpp/src/Ice/IPEndpointI.h
+++ b/cpp/src/Ice/IPEndpointI.h
@@ -61,7 +61,8 @@ public:
virtual EndpointIPtr connectionId(const ::std::string&) const;
virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const;
- virtual std::vector<EndpointIPtr> expand() const;
+ virtual std::vector<EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<EndpointIPtr> expandHost(EndpointIPtr&) const;
virtual bool equivalent(const EndpointIPtr&) const;
virtual ::Ice::Int hash() const;
virtual std::string options() const;
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 599f6537896..b1c48af121b 100755
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -2364,7 +2364,8 @@ IceInternal::doBind(SOCKET fd, const Address& addr, const string&)
Address
IceInternal::getNumericAddress(const std::string& address)
{
- vector<Address> addrs = getAddresses(address, 0, EnableBoth, Ice::ICE_ENUM(EndpointSelectionType, Ordered), false, false);
+ vector<Address> addrs = getAddresses(address, 0, EnableBoth, Ice::ICE_ENUM(EndpointSelectionType, Ordered), false,
+ false);
if(addrs.empty())
{
return Address();
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 5de6bf0acaa..bc22131f8cf 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -787,7 +787,7 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrxPtr& proxy) const
for(vector<IncomingConnectionFactoryPtr>::const_iterator q = _incomingConnectionFactories.begin();
q != _incomingConnectionFactories.end(); ++q)
{
- if((*p)->equivalent((*q)->endpoint()))
+ if((*q)->isLocal(*p))
{
return true;
}
@@ -1102,11 +1102,19 @@ Ice::ObjectAdapterI::initialize(const RouterPrxPtr& router)
vector<EndpointIPtr> endpoints = parseEndpoints(properties->getProperty(_name + ".Endpoints"), true);
for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
- IncomingConnectionFactoryPtr factory = ICE_MAKE_SHARED(IncomingConnectionFactory, _instance, *p, ICE_SHARED_FROM_THIS);
- factory->initialize();
- _incomingConnectionFactories.push_back(factory);
+ EndpointIPtr publishedEndpoint;
+ vector<EndpointIPtr> expanded = (*p)->expandHost(publishedEndpoint);
+ for(vector<EndpointIPtr>::iterator q = expanded.begin(); q != expanded.end(); ++q)
+ {
+ IncomingConnectionFactoryPtr factory = ICE_MAKE_SHARED(IncomingConnectionFactory,
+ _instance,
+ *q,
+ publishedEndpoint,
+ ICE_SHARED_FROM_THIS);
+ factory->initialize();
+ _incomingConnectionFactories.push_back(factory);
+ }
}
-
if(endpoints.empty())
{
TraceLevelsPtr tl = _instance->traceLevels();
@@ -1322,8 +1330,19 @@ ObjectAdapterI::parsePublishedEndpoints()
//
for(unsigned int i = 0; i < _incomingConnectionFactories.size(); ++i)
{
- vector<EndpointIPtr> endps = _incomingConnectionFactories[i]->endpoint()->expand();
- endpoints.insert(endpoints.end(), endps.begin(), endps.end());
+ vector<EndpointIPtr> endps = _incomingConnectionFactories[i]->endpoint()->expandIfWildcard();
+ for(vector<EndpointIPtr>::const_iterator p = endps.begin(); p != endps.end(); ++p)
+ {
+ //
+ // Check for duplicate endpoints, this might occur if an endpoint with a DNS name
+ // expands to multiple addresses. In this case, multiple incoming connection
+ // factories can point to the same published endpoint.
+ //
+ if(::find(endpoints.begin(), endpoints.end(), *p) == endpoints.end())
+ {
+ endpoints.push_back(*p);
+ }
+ }
}
}
diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp
index 77da8121e7f..065af32eae9 100644
--- a/cpp/src/Ice/OpaqueEndpointI.cpp
+++ b/cpp/src/Ice/OpaqueEndpointI.cpp
@@ -190,7 +190,15 @@ IceInternal::OpaqueEndpointI::acceptor(const string&) const
}
vector<EndpointIPtr>
-IceInternal::OpaqueEndpointI::expand() const
+IceInternal::OpaqueEndpointI::expandIfWildcard() const
+{
+ vector<EndpointIPtr> endps;
+ endps.push_back(ICE_SHARED_FROM_CONST_THIS(OpaqueEndpointI));
+ return endps;
+}
+
+vector<EndpointIPtr>
+IceInternal::OpaqueEndpointI::expandHost(EndpointIPtr&) const
{
vector<EndpointIPtr> endps;
endps.push_back(ICE_SHARED_FROM_CONST_THIS(OpaqueEndpointI));
diff --git a/cpp/src/Ice/OpaqueEndpointI.h b/cpp/src/Ice/OpaqueEndpointI.h
index 582764bfd30..873706abd53 100644
--- a/cpp/src/Ice/OpaqueEndpointI.h
+++ b/cpp/src/Ice/OpaqueEndpointI.h
@@ -43,7 +43,8 @@ public:
virtual TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const;
virtual AcceptorPtr acceptor(const std::string&) const;
- virtual std::vector<EndpointIPtr> expand() const;
+ virtual std::vector<EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<EndpointIPtr> expandHost(EndpointIPtr&) const;
virtual bool equivalent(const EndpointIPtr&) const;
virtual Ice::Int hash() const;
virtual std::string options() const;
diff --git a/cpp/src/Ice/WSEndpoint.cpp b/cpp/src/Ice/WSEndpoint.cpp
index 974f998412a..c19842d652f 100644
--- a/cpp/src/Ice/WSEndpoint.cpp
+++ b/cpp/src/Ice/WSEndpoint.cpp
@@ -232,12 +232,45 @@ IceInternal::WSEndpoint::endpoint(const EndpointIPtr& delEndp) const
}
vector<EndpointIPtr>
-IceInternal::WSEndpoint::expand() const
+IceInternal::WSEndpoint::expandIfWildcard() const
{
- vector<EndpointIPtr> endps = _delegate->expand();
+ vector<EndpointIPtr> endps = _delegate->expandIfWildcard();
for(vector<EndpointIPtr>::iterator p = endps.begin(); p != endps.end(); ++p)
{
- *p = p->get() == _delegate.get() ? ICE_SHARED_FROM_CONST_THIS(WSEndpoint) : ICE_MAKE_SHARED(WSEndpoint, _instance, *p, _resource);
+ if(p->get() == _delegate.get())
+ {
+ *p = ICE_SHARED_FROM_CONST_THIS(WSEndpoint);
+ }
+ else
+ {
+ *p = ICE_MAKE_SHARED(WSEndpoint, _instance, *p, _resource);
+ }
+ }
+ return endps;
+}
+
+vector<EndpointIPtr>
+IceInternal::WSEndpoint::expandHost(EndpointIPtr& publish) const
+{
+ vector<EndpointIPtr> endps = _delegate->expandHost(publish);
+ if(publish.get() == _delegate.get())
+ {
+ publish = ICE_SHARED_FROM_CONST_THIS(WSEndpoint);
+ }
+ else if(publish.get())
+ {
+ publish = ICE_MAKE_SHARED(WSEndpoint, _instance, publish, _resource);
+ }
+ for(vector<EndpointIPtr>::iterator p = endps.begin(); p != endps.end(); ++p)
+ {
+ if(p->get() == _delegate.get())
+ {
+ *p = ICE_SHARED_FROM_CONST_THIS(WSEndpoint);
+ }
+ else
+ {
+ *p = ICE_MAKE_SHARED(WSEndpoint, _instance, *p, _resource);
+ }
}
return endps;
}
diff --git a/cpp/src/Ice/WSEndpoint.h b/cpp/src/Ice/WSEndpoint.h
index 23ffe0ddb1e..fe38fe331cf 100644
--- a/cpp/src/Ice/WSEndpoint.h
+++ b/cpp/src/Ice/WSEndpoint.h
@@ -49,8 +49,8 @@ public:
virtual TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const EndpointI_connectorsPtr&) const;
virtual AcceptorPtr acceptor(const std::string&) const;
-
- virtual std::vector<EndpointIPtr> expand() const;
+ virtual std::vector<EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<EndpointIPtr> expandHost(EndpointIPtr&) const;
virtual bool equivalent(const EndpointIPtr&) const;
virtual ::Ice::Int hash() const;
virtual std::string options() const;
diff --git a/cpp/src/IceBT/EndpointI.cpp b/cpp/src/IceBT/EndpointI.cpp
index 1209dc8f121..a081b36747f 100644
--- a/cpp/src/IceBT/EndpointI.cpp
+++ b/cpp/src/IceBT/EndpointI.cpp
@@ -185,7 +185,18 @@ IceBT::EndpointI::acceptor(const string& adapterName) const
}
vector<IceInternal::EndpointIPtr>
-IceBT::EndpointI::expand() const
+IceBT::EndpointI::expandIfWildcard() const
+{
+ //
+ // Nothing to do here.
+ //
+ vector<IceInternal::EndpointIPtr> endps;
+ endps.push_back(ICE_SHARED_FROM_CONST_THIS(EndpointI));
+ return endps;
+}
+
+vector<IceInternal::EndpointIPtr>
+IceBT::EndpointI::expandHost(IceInternal::EndpointIPtr&) const
{
//
// Nothing to do here.
diff --git a/cpp/src/IceBT/EndpointI.h b/cpp/src/IceBT/EndpointI.h
index bc935428965..8e322574a1f 100644
--- a/cpp/src/IceBT/EndpointI.h
+++ b/cpp/src/IceBT/EndpointI.h
@@ -47,7 +47,8 @@ public:
virtual IceInternal::TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
- virtual std::vector<IceInternal::EndpointIPtr> expand() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandHost(IceInternal::EndpointIPtr&) const;
virtual bool equivalent(const IceInternal::EndpointIPtr&) const;
#ifdef ICE_CPP11_MAPPING
diff --git a/cpp/src/IceIAP/EndpointI.h b/cpp/src/IceIAP/EndpointI.h
index 1194a6450da..8e71869eb70 100644
--- a/cpp/src/IceIAP/EndpointI.h
+++ b/cpp/src/IceIAP/EndpointI.h
@@ -54,8 +54,8 @@ public:
virtual IceInternal::TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
-
- virtual std::vector<IceInternal::EndpointIPtr> expand() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandHost(IceInternal::EndpointIPtr&) const;
virtual bool equivalent(const IceInternal::EndpointIPtr&) const;
#ifdef ICE_CPP11_MAPPING
diff --git a/cpp/src/IceIAP/EndpointI.mm b/cpp/src/IceIAP/EndpointI.mm
index 87c071cbb69..1914e3e79ba 100644
--- a/cpp/src/IceIAP/EndpointI.mm
+++ b/cpp/src/IceIAP/EndpointI.mm
@@ -300,7 +300,15 @@ IceObjC::iAPEndpointI::acceptor(const string&) const
}
vector<EndpointIPtr>
-IceObjC::iAPEndpointI::expand() const
+IceObjC::iAPEndpointI::expandIfWildcard() const
+{
+ vector<EndpointIPtr> endps;
+ endps.push_back(ICE_SHARED_FROM_CONST_THIS(iAPEndpointI));
+ return endps;
+}
+
+vector<EndpointIPtr>
+IceObjC::iAPEndpointI::expandHost(EndpointIPtr&) const
{
vector<EndpointIPtr> endps;
endps.push_back(ICE_SHARED_FROM_CONST_THIS(iAPEndpointI));
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp
index 972c220b7dd..2300bffa4cb 100644
--- a/cpp/src/IceSSL/EndpointI.cpp
+++ b/cpp/src/IceSSL/EndpointI.cpp
@@ -207,12 +207,45 @@ IceSSL::EndpointI::endpoint(const IceInternal::EndpointIPtr& delEndp) const
}
vector<IceInternal::EndpointIPtr>
-IceSSL::EndpointI::expand() const
+IceSSL::EndpointI::expandIfWildcard() const
{
- vector<IceInternal::EndpointIPtr> endps = _delegate->expand();
+ vector<IceInternal::EndpointIPtr> endps = _delegate->expandIfWildcard();
for(vector<IceInternal::EndpointIPtr>::iterator p = endps.begin(); p != endps.end(); ++p)
{
- *p = p->get() == _delegate.get() ? ICE_SHARED_FROM_CONST_THIS(EndpointI) : ICE_MAKE_SHARED(EndpointI, _instance, *p);
+ if(p->get() == _delegate.get())
+ {
+ *p = ICE_SHARED_FROM_CONST_THIS(EndpointI);
+ }
+ else
+ {
+ *p = ICE_MAKE_SHARED(EndpointI, _instance, *p);
+ }
+ }
+ return endps;
+}
+
+vector<IceInternal::EndpointIPtr>
+IceSSL::EndpointI::expandHost(IceInternal::EndpointIPtr& publish) const
+{
+ vector<IceInternal::EndpointIPtr> endps = _delegate->expandHost(publish);
+ if(publish.get() == _delegate.get())
+ {
+ publish = ICE_SHARED_FROM_CONST_THIS(EndpointI);
+ }
+ else if(publish.get())
+ {
+ publish = ICE_MAKE_SHARED(EndpointI, _instance, publish);
+ }
+ for(vector<IceInternal::EndpointIPtr>::iterator p = endps.begin(); p != endps.end(); ++p)
+ {
+ if(p->get() == _delegate.get())
+ {
+ *p = ICE_SHARED_FROM_CONST_THIS(EndpointI);
+ }
+ else
+ {
+ *p = ICE_MAKE_SHARED(EndpointI, _instance, *p);
+ }
}
return endps;
}
diff --git a/cpp/src/IceSSL/EndpointI.h b/cpp/src/IceSSL/EndpointI.h
index 413aa99a6dd..d27a7182a4a 100644
--- a/cpp/src/IceSSL/EndpointI.h
+++ b/cpp/src/IceSSL/EndpointI.h
@@ -47,8 +47,8 @@ public:
virtual IceInternal::TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
-
- virtual std::vector<IceInternal::EndpointIPtr> expand() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandHost(IceInternal::EndpointIPtr&) const;
virtual bool equivalent(const IceInternal::EndpointIPtr&) const;
virtual ::Ice::Int hash() const;
virtual std::string options() const;
diff --git a/cpp/test/Ice/background/EndpointI.cpp b/cpp/test/Ice/background/EndpointI.cpp
index dd0ae6dcd2a..965d64fafea 100644
--- a/cpp/test/Ice/background/EndpointI.cpp
+++ b/cpp/test/Ice/background/EndpointI.cpp
@@ -212,9 +212,24 @@ EndpointI::endpoint(const IceInternal::EndpointIPtr& delEndp) const
}
vector<IceInternal::EndpointIPtr>
-EndpointI::expand() const
+EndpointI::expandIfWildcard() const
{
- vector<IceInternal::EndpointIPtr> e = _endpoint->expand();
+ vector<IceInternal::EndpointIPtr> e = _endpoint->expandIfWildcard();
+ for(vector<IceInternal::EndpointIPtr>::iterator p = e.begin(); p != e.end(); ++p)
+ {
+ *p = (*p == _endpoint) ? ICE_SHARED_FROM_CONST_THIS(EndpointI) : ICE_MAKE_SHARED(EndpointI, *p);
+ }
+ return e;
+}
+
+vector<IceInternal::EndpointIPtr>
+EndpointI::expandHost(IceInternal::EndpointIPtr& publish) const
+{
+ vector<IceInternal::EndpointIPtr> e = _endpoint->expandHost(publish);
+ if(publish)
+ {
+ publish = publish == _endpoint ? ICE_SHARED_FROM_CONST_THIS(EndpointI) : ICE_MAKE_SHARED(EndpointI, publish);
+ }
for(vector<IceInternal::EndpointIPtr>::iterator p = e.begin(); p != e.end(); ++p)
{
*p = (*p == _endpoint) ? ICE_SHARED_FROM_CONST_THIS(EndpointI) : ICE_MAKE_SHARED(EndpointI, *p);
diff --git a/cpp/test/Ice/background/EndpointI.h b/cpp/test/Ice/background/EndpointI.h
index 2c70a1dfb4e..46231d7d602 100644
--- a/cpp/test/Ice/background/EndpointI.h
+++ b/cpp/test/Ice/background/EndpointI.h
@@ -39,8 +39,8 @@ public:
virtual IceInternal::TransceiverPtr transceiver() const;
virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
-
- virtual std::vector<IceInternal::EndpointIPtr> expand() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandIfWildcard() const;
+ virtual std::vector<IceInternal::EndpointIPtr> expandHost(IceInternal::EndpointIPtr&) const;
virtual bool equivalent(const IceInternal::EndpointIPtr&) const;
// From TestEndpoint