diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/test/Ice/binding/TestI.cpp | 14 | ||||
-rw-r--r-- | cpp/test/Ice/binding/TestI.h | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/cpp/test/Ice/binding/TestI.cpp b/cpp/test/Ice/binding/TestI.cpp index a802fa4565a..38d5aa00a3d 100644 --- a/cpp/test/Ice/binding/TestI.cpp +++ b/cpp/test/Ice/binding/TestI.cpp @@ -14,9 +14,21 @@ using namespace std; using namespace Ice; using namespace Test; +RemoteCommunicatorI::RemoteCommunicatorI() : _nextPort(10001) +{ +} + RemoteObjectAdapterPrx -RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpoints, const Current& current) +RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpts, const Current& current) { + string endpoints = endpts; + if(endpoints.find("-p") == string::npos) + { + // Use a fixed port if none is specified (bug 2896) + ostringstream os; + os << endpoints << " -h 127.0.0.1 -p " << _nextPort++; + } + Ice::CommunicatorPtr com = current.adapter->getCommunicator(); com->getProperties()->setProperty(name + ".ThreadPool.Size", "1"); ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints); diff --git a/cpp/test/Ice/binding/TestI.h b/cpp/test/Ice/binding/TestI.h index 3a9bdc62d79..2cad3a607e1 100644 --- a/cpp/test/Ice/binding/TestI.h +++ b/cpp/test/Ice/binding/TestI.h @@ -16,10 +16,16 @@ class RemoteCommunicatorI : public Test::RemoteCommunicator { public: + RemoteCommunicatorI(); + virtual Test::RemoteObjectAdapterPrx createObjectAdapter(const std::string&, const std::string&, const Ice::Current&); virtual void deactivateObjectAdapter(const Test::RemoteObjectAdapterPrx&, const Ice::Current&); virtual void shutdown(const Ice::Current&); + +private: + + int _nextPort; }; class RemoteObjectAdapterI : public Test::RemoteObjectAdapter |