summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/echo/BlobjectI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
commit1597a75419cd8049252cfbca6fce6ae95ef8b2c7 (patch)
tree2b2c858df1dbe68c1d576cae06c4713fd2ad5c40 /cpp/test/Ice/echo/BlobjectI.cpp
parentUse Ice\None with PHP namespace mapping (diff)
downloadice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.bz2
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.xz
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.zip
Fix for ICE-7125 - Added support for Ice.ClassGraphDepthMax
Diffstat (limited to 'cpp/test/Ice/echo/BlobjectI.cpp')
-rw-r--r--cpp/test/Ice/echo/BlobjectI.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/cpp/test/Ice/echo/BlobjectI.cpp b/cpp/test/Ice/echo/BlobjectI.cpp
index 024b239ac4f..894e217569c 100644
--- a/cpp/test/Ice/echo/BlobjectI.cpp
+++ b/cpp/test/Ice/echo/BlobjectI.cpp
@@ -54,6 +54,14 @@ BlobjectI::BlobjectI() :
}
void
+BlobjectI::setConnection(const Ice::ConnectionPtr& connection)
+{
+ Lock sync(*this);
+ _connection = connection;
+ notifyAll();
+}
+
+void
BlobjectI::startBatch()
{
assert(!_batchProxy);
@@ -75,8 +83,9 @@ BlobjectI::ice_invokeAsync(std::vector<Ice::Byte> inEncaps,
std::function<void(std::exception_ptr)> ex,
const Ice::Current& current)
{
+ auto connection = getConnection(current);
const bool twoway = current.requestId > 0;
- auto obj = current.con->createProxy(current.id);
+ auto obj = connection->createProxy(current.id);
if(!twoway)
{
if(_startBatch)
@@ -124,8 +133,9 @@ void
BlobjectI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& amdCb, const vector<Ice::Byte>& inEncaps,
const Ice::Current& current)
{
+ Ice::ConnectionPtr connection = getConnection(current);
const bool twoway = current.requestId > 0;
- Ice::ObjectPrx obj = current.con->createProxy(current.id);
+ Ice::ObjectPrx obj = connection->createProxy(current.id);
if(!twoway)
{
if(_startBatch)
@@ -171,3 +181,30 @@ BlobjectI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& amdCb, const ve
}
}
#endif
+
+Ice::ConnectionPtr
+BlobjectI::getConnection(const Ice::Current& current)
+{
+ Lock sync(*this);
+ if(!_connection)
+ {
+ return current.con;
+ }
+
+ try
+ {
+ _connection->throwException();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ // If we lost the connection, wait 5 seconds for the server to re-establish it. Some tests,
+ // involve connection closure (e.g.: exceptions MemoryLimitException test) and the server
+ // automatically re-establishes the connection with the echo server.
+ timedWait(IceUtil::Time::seconds(5));
+ if(!_connection)
+ {
+ throw;
+ }
+ }
+ return _connection;
+}