summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2017-02-09 16:31:31 -0800
committerMark Spruiell <mes@zeroc.com>2017-02-09 16:31:31 -0800
commitaf409fe78bdca7db6315ab0cc99ad063f8daecf7 (patch)
treeb0079f556247a14f43e77ca6a31cb42df019485b /cpp
parentFixed enum-related warnings (diff)
downloadice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.tar.bz2
ice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.tar.xz
ice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.zip
ICE-7560 - more AMI test fixes, renaming ConnectionClose enumerators
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Glacier2/RoutingTable.cpp2
-rw-r--r--cpp/src/Glacier2/SessionRouterI.cpp6
-rw-r--r--cpp/src/Ice/ConnectionI.cpp6
-rw-r--r--cpp/src/IceBridge/IceBridge.cpp11
-rw-r--r--cpp/src/IceGrid/SessionManager.cpp2
-rw-r--r--cpp/test/Ice/ami/AllTests.cpp256
-rw-r--r--cpp/test/Ice/ami/Test.ice9
-rw-r--r--cpp/test/Ice/ami/TestI.cpp57
-rw-r--r--cpp/test/Ice/ami/TestI.h14
-rw-r--r--cpp/test/Ice/background/AllTests.cpp42
-rw-r--r--cpp/test/Ice/binding/AllTests.cpp46
-rw-r--r--cpp/test/Ice/hold/AllTests.cpp4
-rw-r--r--cpp/test/Ice/location/AllTests.cpp2
-rw-r--r--cpp/test/Ice/metrics/AllTests.cpp19
-rw-r--r--cpp/test/Ice/metrics/TestAMDI.cpp4
-rw-r--r--cpp/test/Ice/metrics/TestI.cpp2
-rw-r--r--cpp/test/Ice/operations/BatchOneways.cpp4
-rw-r--r--cpp/test/Ice/operations/BatchOnewaysAMI.cpp8
-rw-r--r--cpp/test/Ice/retry/TestI.cpp2
-rw-r--r--cpp/test/Ice/timeout/AllTests.cpp2
-rw-r--r--cpp/test/Ice/udp/AllTests.cpp2
-rw-r--r--cpp/test/IceSSL/configuration/AllTests.cpp2
-rw-r--r--cpp/test/IceStorm/stress/Subscriber.cpp2
23 files changed, 292 insertions, 212 deletions
diff --git a/cpp/src/Glacier2/RoutingTable.cpp b/cpp/src/Glacier2/RoutingTable.cpp
index e6b090de4cb..feb329e61b6 100644
--- a/cpp/src/Glacier2/RoutingTable.cpp
+++ b/cpp/src/Glacier2/RoutingTable.cpp
@@ -65,7 +65,7 @@ Glacier2::RoutingTable::add(const ObjectProxySeq& unfiltered, const Current& cur
if(!_verifier->verify(*prx))
{
- current.con->close(CloseForcefully);
+ current.con->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
throw ObjectNotExistException(__FILE__, __LINE__);
}
ObjectPrx proxy = (*prx)->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form.
diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp
index 512d371611f..daed57a99d1 100644
--- a/cpp/src/Glacier2/SessionRouterI.cpp
+++ b/cpp/src/Glacier2/SessionRouterI.cpp
@@ -80,7 +80,7 @@ public:
// Close the connection otherwise the peer has no way to know that
// the session has gone.
//
- _connection->close(CloseForcefully);
+ _connection->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
_router->destroySession(_connection);
}
}
@@ -922,7 +922,7 @@ SessionRouterI::refreshSession(const Ice::ConnectionPtr& con)
// Close the connection otherwise the peer has no way to know that the
// session has gone.
//
- con->close(CloseForcefully);
+ con->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
throw SessionNotExistException();
}
}
@@ -1152,7 +1152,7 @@ SessionRouterI::getRouterImpl(const ConnectionPtr& connection, const Ice::Identi
out << "rejecting request, no session is associated with the connection.\n";
out << "identity: " << identityToString(id);
}
- connection->close(CloseForcefully);
+ connection->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
throw ObjectNotExistException(__FILE__, __LINE__);
}
return 0;
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 223326203d1..1341cc44e5b 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -498,17 +498,17 @@ Ice::ConnectionI::close(ConnectionClose mode)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(mode == ICE_ENUM(ConnectionClose, CloseForcefully))
+ if(mode == ICE_SCOPED_ENUM(ConnectionClose, Forcefully))
{
setState(StateClosed, ConnectionManuallyClosedException(__FILE__, __LINE__, false));
}
- else if(mode == ICE_ENUM(ConnectionClose, CloseGracefully))
+ else if(mode == ICE_SCOPED_ENUM(ConnectionClose, Gracefully))
{
setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true));
}
else
{
- assert(mode == ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ assert(mode == ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
//
// Wait until all outstanding requests have been completed.
diff --git a/cpp/src/IceBridge/IceBridge.cpp b/cpp/src/IceBridge/IceBridge.cpp
index 31ec58aae6c..f3f520cf678 100644
--- a/cpp/src/IceBridge/IceBridge.cpp
+++ b/cpp/src/IceBridge/IceBridge.cpp
@@ -167,7 +167,7 @@ public:
// The incoming connection is already closed. There's no point in leaving the outgoing
// connection open.
//
- outgoing->close(CloseGracefully);
+ outgoing->close(ICE_SCOPED_ENUM(ConnectionClose, Gracefully));
}
else
{
@@ -206,7 +206,7 @@ public:
//
if(_incoming)
{
- _incoming->close(CloseGracefully);
+ _incoming->close(ICE_SCOPED_ENUM(ConnectionClose, Gracefully));
}
}
}
@@ -258,18 +258,19 @@ public:
}
catch(const Ice::CloseConnectionException&)
{
- toBeClosed->close(CloseGracefully);
+ toBeClosed->close(ICE_SCOPED_ENUM(ConnectionClose, Gracefully));
}
catch(const Ice::ConnectionManuallyClosedException& ex)
{
//
// Connection was manually closed by the bridge.
//
- toBeClosed->close(ex.graceful ? CloseGracefully : CloseForcefully);
+ toBeClosed->close(ex.graceful ? ICE_SCOPED_ENUM(ConnectionClose, Gracefully) :
+ ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
}
catch(...)
{
- toBeClosed->close(CloseForcefully);
+ toBeClosed->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
}
}
diff --git a/cpp/src/IceGrid/SessionManager.cpp b/cpp/src/IceGrid/SessionManager.cpp
index c9b371000ff..1aa2701574e 100644
--- a/cpp/src/IceGrid/SessionManager.cpp
+++ b/cpp/src/IceGrid/SessionManager.cpp
@@ -58,7 +58,7 @@ SessionManager::findAllQueryObjects(bool cached)
{
try
{
- connection->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ connection->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
catch(const Ice::LocalException&)
{
diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp
index 1bea36d06d0..ba49a3ec662 100644
--- a/cpp/test/Ice/ami/AllTests.cpp
+++ b/cpp/test/Ice/ami/AllTests.cpp
@@ -1865,7 +1865,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(p->opBatchCount() == 0);
auto b1 = p->ice_batchOneway();
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
auto id = this_thread::get_id();
promise<void> promise;
@@ -1941,7 +1941,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
auto b1 = Ice::uncheckedCast<Test::TestIntfPrx>(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
promise<void> promise;
b1->ice_getConnection()->flushBatchRequestsAsync(
@@ -2021,7 +2021,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
auto b1 = Ice::uncheckedCast<Test::TestIntfPrx>(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
promise<void> promise;
auto id = this_thread::get_id();
@@ -2093,8 +2093,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->ice_getConnection(); // Ensure connection is established.
b1->opBatch();
b2->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ b2->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
promise<void> promise;
auto id = this_thread::get_id();
@@ -2181,35 +2181,31 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
}
cout << "ok" << endl;
- if(p->ice_getConnection() && protocol != "bt")
+ if(p->ice_getConnection() && protocol != "bt" && p->supportsAMD())
{
cout << "testing graceful close connection with wait... " << flush;
{
//
- // Local case: begin several requests, close the connection gracefully, and make sure it waits
- // for the requests to complete.
+ // Local case: begin a request, close the connection gracefully, and make sure it waits
+ // for the request to complete.
//
- vector<future<void>> results;
- for(int i = 0; i < 3; ++i)
- {
- auto s = make_shared<promise<void>>();
- p->sleepAsync(50,
- [s]() { s->set_value(); },
- [s](exception_ptr ex) { s->set_exception(ex); });
- results.push_back(s->get_future());
- }
- p->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- for(vector<future<void>>::iterator p = results.begin(); p != results.end(); ++p)
- {
- try
- {
- p->get();
- }
- catch(const Ice::LocalException&)
+ auto con = p->ice_getConnection();
+ auto sc = make_shared<promise<void>>();
+ con->setCloseCallback(
+ [sc](Ice::ConnectionPtr connection)
{
- test(false);
- }
- }
+ sc->set_value();
+ });
+ auto fc = sc->get_future();
+ auto s = make_shared<promise<void>>();
+ p->sleepAsync(100,
+ [s]() { s->set_value(); },
+ [s](exception_ptr ex) { s->set_exception(ex); });
+ auto f = s->get_future();
+ // Blocks until the request completes.
+ con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ f.get(); // Should complete successfully.
+ fc.get();
}
{
//
@@ -2222,10 +2218,11 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
*q = static_cast<Ice::Byte>(IceUtilInternal::random(255));
}
-
+ //
// Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod.
// The goal is to make sure that none of the opWithPayload fail even if the server closes
// the connection gracefully in between.
+ //
int maxQueue = 2;
bool done = false;
@@ -2243,7 +2240,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
results.push_back(s->get_future());
}
atomic_flag sent = ATOMIC_FLAG_INIT;
- p->closeAsync(Test::CloseMode::CloseGracefullyAndWait, nullptr, nullptr,
+ p->closeAsync(Test::CloseMode::GracefullyWithWait, nullptr, nullptr,
[&sent](bool) { sent.test_and_set(); });
if(!sent.test_and_set())
{
@@ -2288,21 +2285,20 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
cout << "testing graceful close connection without wait... " << flush;
{
//
- // Local case: start a lengthy operation and then close the connection gracefully on the client side
+ // Local case: start an operation and then close the connection gracefully on the client side
// without waiting for the pending invocation to complete. There will be no retry and we expect the
// invocation to fail with ConnectionManuallyClosedException.
//
- // This test requires two threads in the server's thread pool: one will block in sleep() and the other
- // will process the CloseConnection message.
- //
- p->ice_ping();
+ p = p->ice_connectionId("CloseGracefully"); // Start with a new connection.
auto con = p->ice_getConnection();
auto s = make_shared<promise<void>>();
- p->sleepAsync(100,
- [s]() { s->set_value(); },
- [s](exception_ptr ex) { s->set_exception(ex); });
- future<void> f = s->get_future();
- con->close(Ice::ConnectionClose::CloseGracefully);
+ auto sent = make_shared<promise<void>>();
+ p->startDispatchAsync([s]() { s->set_value(); },
+ [s](exception_ptr ex) { s->set_exception(ex); },
+ [sent](bool ss) { sent->set_value(); });
+ auto f = s->get_future();
+ sent->get_future().get(); // Ensure the request was sent before we close the connection.
+ con->close(Ice::ConnectionClose::Gracefully);
try
{
f.get();
@@ -2312,14 +2308,12 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(ex.graceful);
}
+ p->finishDispatch();
//
- // Remote case: the server closes the connection gracefully. Our call to TestIntf::close()
- // completes successfully and then the connection should be closed immediately afterward,
- // despite the fact that there's a pending call to sleep(). The call to sleep() should be
- // automatically retried and complete successfully with a new connection.
+ // Remote case: the server closes the connection gracefully, which means the connection
+ // will not be closed until all pending dispatched requests have completed.
//
- p->ice_ping();
con = p->ice_getConnection();
auto sc = make_shared<promise<void>>();
con->setCloseCallback(
@@ -2327,14 +2321,14 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
sc->set_value();
});
- future<void> fc = sc->get_future();
+ auto fc = sc->get_future();
s = make_shared<promise<void>>();
p->sleepAsync(100,
[s]() { s->set_value(); },
[s](exception_ptr ex) { s->set_exception(ex); });
f = s->get_future();
- p->close(Test::CloseMode::CloseGracefully);
- fc.get();
+ p->close(Test::CloseMode::Gracefully); // Close is delayed until sleep completes.
+ fc.get(); // Ensure connection was closed.
try
{
f.get();
@@ -2343,8 +2337,6 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(false);
}
- p->ice_ping();
- test(p->ice_getConnection() != con);
}
cout << "ok" << endl;
@@ -2357,11 +2349,13 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
p->ice_ping();
auto con = p->ice_getConnection();
auto s = make_shared<promise<void>>();
- p->sleepAsync(100,
- [s]() { s->set_value(); },
- [s](exception_ptr ex) { s->set_exception(ex); });
- future<void> f = s->get_future();
- con->close(Ice::ConnectionClose::CloseForcefully);
+ auto sent = make_shared<promise<void>>();
+ p->startDispatchAsync([s]() { s->set_value(); },
+ [s](exception_ptr ex) { s->set_exception(ex); },
+ [sent](bool ss) { sent->set_value(); });
+ auto f = s->get_future();
+ sent->get_future().get(); // Ensure the request was sent before we close the connection.
+ con->close(Ice::ConnectionClose::Forcefully);
try
{
f.get();
@@ -2371,6 +2365,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(!ex.graceful);
}
+ p->finishDispatch();
//
// Remote case: the server closes the connection forcefully. This causes the request to fail
@@ -2379,7 +2374,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- p->close(Test::CloseMode::CloseForcefully);
+ p->close(Test::CloseMode::Forcefully);
test(false);
}
catch(const Ice::ConnectionLostException&)
@@ -3100,7 +3095,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(p->opBatchCount() == 0);
Test::TestIntfPrx b1 = p->ice_batchOneway();
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
Ice::AsyncResultPtr r = b1->begin_ice_flushBatchRequests(
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
@@ -3118,7 +3113,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(p->opBatchCount() == 0);
Test::TestIntfPrx b1 = p->ice_batchOneway();
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback(cookie);
b1->begin_ice_flushBatchRequests(
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie);
@@ -3169,7 +3164,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(p->opBatchCount() == 0);
Test::TestIntfPrx b1 = p->ice_batchOneway();
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
Ice::AsyncResultPtr r = b1->begin_ice_flushBatchRequests(
Ice::newCallback_Object_ice_flushBatchRequests(cb, &FlushCallback::exception,
@@ -3187,7 +3182,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(p->opBatchCount() == 0);
Test::TestIntfPrx b1 = p->ice_batchOneway();
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback(cookie);
b1->begin_ice_flushBatchRequests(
Ice::newCallback_Object_ice_flushBatchRequests(cb, &FlushCallback::exceptionWC,
@@ -3215,7 +3210,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b1->opBatch();
b1->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent());
@@ -3256,9 +3252,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushExCallbackPtr cb = new FlushExCallback();
- Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushExCallback::completedAsync, &FlushExCallback::sentAsync));
cb->check();
test(!r->isSent());
@@ -3275,7 +3272,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushExCallbackPtr cb = new FlushExCallback(cookie);
b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushExCallback::completedAsync, &FlushExCallback::sentAsync), cookie);
@@ -3293,8 +3290,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b1->opBatch();
b1->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
- Ice::newCallback_Connection_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent));
+ Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::newCallback_Connection_flushBatchRequests(cb, &FlushCallback::exception,
+ &FlushCallback::sent));
cb->check();
test(r->isSent());
test(r->isCompleted());
@@ -3327,9 +3326,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushExCallbackPtr cb = new FlushExCallback();
- Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Connection_flushBatchRequests(cb, &FlushExCallback::exception,
&FlushExCallback::sent));
cb->check();
@@ -3347,7 +3347,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushExCallbackPtr cb = new FlushExCallback(cookie);
b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Connection_flushBatchRequests(cb, &FlushExCallback::exceptionWC,
@@ -3372,7 +3372,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b1->opBatch();
b1->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent());
@@ -3405,9 +3406,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent()); // Exceptions are ignored!
@@ -3424,7 +3426,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback(cookie);
communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie);
@@ -3449,7 +3451,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->opBatch();
b2->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent());
@@ -3475,9 +3478,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->ice_getConnection(); // Ensure connection is established.
b1->opBatch();
b2->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent()); // Exceptions are ignored!
@@ -3502,10 +3506,11 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->ice_getConnection(); // Ensure connection is established.
b1->opBatch();
b2->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ b2->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync));
cb->check();
test(r->isSent()); // Exceptions are ignored!
@@ -3523,7 +3528,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b1->opBatch();
b1->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception,
&FlushCallback::sent));
cb->check();
@@ -3558,9 +3564,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception,
&FlushCallback::sent));
cb->check();
@@ -3578,7 +3585,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast(
p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway());
b1->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback(cookie);
communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exceptionWC,
@@ -3605,7 +3612,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->opBatch();
b2->opBatch();
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception,
&FlushCallback::sent));
cb->check();
@@ -3632,9 +3640,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->ice_getConnection(); // Ensure connection is established.
b1->opBatch();
b2->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception,
&FlushCallback::sent));
cb->check();
@@ -3660,10 +3669,11 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
b2->ice_getConnection(); // Ensure connection is established.
b1->opBatch();
b2->opBatch();
- b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ b1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ b2->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
FlushCallbackPtr cb = new FlushCallback();
- Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
+ Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(
+ Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy),
Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception,
&FlushCallback::sent));
cb->check();
@@ -3874,27 +3884,25 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
cout << "testing graceful close connection with wait... " << flush;
{
//
- // Local case: begin several requests, close the connection gracefully, and make sure it waits
- // for the requests to complete.
+ // Local case: begin a request, close the connection gracefully, and make sure it waits
+ // for the request to complete.
//
- vector<Ice::AsyncResultPtr> results;
- for(int i = 0; i < 3; ++i)
+ Ice::ConnectionPtr con = p->ice_getConnection();
+ CloseCallbackPtr cb = new CloseCallback;
+ con->setCloseCallback(cb);
+ Ice::AsyncResultPtr r = p->begin_sleep(100);
+ // Blocks until the request completes.
+ con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ r->waitForCompleted(); // Should complete successfully.
+ try
{
- results.push_back(p->begin_sleep(50));
+ r->throwLocalException();
}
- p->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- for(vector<Ice::AsyncResultPtr>::const_iterator q = results.begin(); q != results.end(); ++q)
+ catch(const Ice::LocalException&)
{
- (*q)->waitForCompleted();
- try
- {
- (*q)->throwLocalException();
- }
- catch(const Ice::LocalException&)
- {
- test(false);
- }
+ test(false);
}
+ cb->check();
}
{
//
@@ -3923,7 +3931,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
results.push_back(p->begin_opWithPayload(seq));
}
- if(!p->begin_close(Test::CloseGracefullyAndWait)->isSent())
+ if(!p->begin_close(Test::GracefullyWithWait)->isSent())
{
for(int i = 0; i < maxQueue; i++)
{
@@ -3962,17 +3970,15 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
cout << "testing graceful close connection without wait... " << flush;
{
//
- // Local case: start a lengthy operation and then close the connection gracefully on the client side
+ // Local case: start an operation and then close the connection gracefully on the client side
// without waiting for the pending invocation to complete. There will be no retry and we expect the
// invocation to fail with ConnectionManuallyClosedException.
//
- // This test requires two threads in the server's thread pool: one will block in sleep() and the other
- // will process the CloseConnection message.
- //
- p->ice_ping();
+ p = p->ice_connectionId("CloseGracefully"); // Start with a new connection.
Ice::ConnectionPtr con = p->ice_getConnection();
- Ice::AsyncResultPtr r = p->begin_sleep(100);
- con->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefully));
+ Ice::AsyncResultPtr r = p->begin_startDispatch();
+ r->waitForSent(); // Ensure the request was sent before we close the connection.
+ con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Gracefully));
r->waitForCompleted();
try
{
@@ -3983,20 +3989,18 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(ex.graceful);
}
+ p->finishDispatch();
//
- // Remote case: the server closes the connection gracefully. Our call to TestIntf::close()
- // completes successfully and then the connection should be closed immediately afterward,
- // despite the fact that there's a pending call to sleep(). The call to sleep() should be
- // automatically retried and complete successfully.
+ // Remote case: the server closes the connection gracefully, which means the connection
+ // will not be closed until all pending dispatched requests have completed.
//
- p->ice_ping();
con = p->ice_getConnection();
CloseCallbackPtr cb = new CloseCallback;
con->setCloseCallback(cb);
r = p->begin_sleep(100);
- p->close(Test::CloseGracefully);
- cb->check();
+ p->close(Test::Gracefully); // Close is delayed until sleep completes.
+ cb->check(); // Ensure connection was closed.
r->waitForCompleted();
try
{
@@ -4006,21 +4010,20 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(false);
}
- p->ice_ping();
- test(p->ice_getConnection() != con);
}
cout << "ok" << endl;
cout << "testing forceful close connection... " << flush;
{
//
- // Local case: start a lengthy operation and then close the connection forcefully on the client side.
+ // Local case: start an operation and then close the connection forcefully on the client side.
// There will be no retry and we expect the invocation to fail with ConnectionManuallyClosedException.
//
p->ice_ping();
Ice::ConnectionPtr con = p->ice_getConnection();
- Ice::AsyncResultPtr r = p->begin_sleep(100);
- con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ Ice::AsyncResultPtr r = p->begin_startDispatch();
+ r->waitForSent(); // Ensure the request was sent before we close the connection.
+ con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
r->waitForCompleted();
try
{
@@ -4031,6 +4034,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(!ex.graceful);
}
+ p->finishDispatch();
//
// Remote case: the server closes the connection forcefully. This causes the request to fail
@@ -4039,7 +4043,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- p->close(Test::CloseForcefully);
+ p->close(Test::Forcefully);
test(false);
}
catch(const Ice::ConnectionLostException&)
diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice
index 1e889d89149..7cc9091d806 100644
--- a/cpp/test/Ice/ami/Test.ice
+++ b/cpp/test/Ice/ami/Test.ice
@@ -20,9 +20,9 @@ exception TestIntfException
enum CloseMode
{
- CloseForcefully,
- CloseGracefully,
- CloseGracefullyAndWait
+ Forcefully,
+ Gracefully,
+ GracefullyWithWait
};
interface TestIntf
@@ -42,8 +42,11 @@ interface TestIntf
bool waitForBatch(int count);
void close(CloseMode mode);
void sleep(int ms);
+ ["amd"] void startDispatch();
+ void finishDispatch();
void shutdown();
+ bool supportsAMD();
bool supportsFunctionalTests();
};
diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp
index d7aa1d44762..b52678a590e 100644
--- a/cpp/test/Ice/ami/TestI.cpp
+++ b/cpp/test/Ice/ami/TestI.cpp
@@ -105,13 +105,69 @@ TestIntfI::sleep(Ice::Int ms, const Ice::Current& current)
timedWait(IceUtil::Time::milliSeconds(ms));
}
+#ifdef ICE_CPP11_MAPPING
+void
+TestIntfI::startDispatchAsync(std::function<void()> response, std::function<void(std::exception_ptr)> ex,
+ const Ice::Current&)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _pending.push_back(move(response));
+}
+#else
+void
+TestIntfI::startDispatch_async(const Test::AMD_TestIntf_startDispatchPtr& cb, const Ice::Current&)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _pending.push_back(cb);
+}
+#endif
+
+void
+TestIntfI::finishDispatch(const Ice::Current& current)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+#ifdef ICE_CPP11_MAPPING
+ for(vector<function<void()>>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)();
+ }
+#else
+ for(vector<Test::AMD_TestIntf_startDispatchPtr>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)->ice_response();
+ }
+#endif
+ _pending.clear();
+}
+
void
TestIntfI::shutdown(const Ice::Current& current)
{
+ //
+ // Just in case a request arrived late.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+#ifdef ICE_CPP11_MAPPING
+ for(vector<function<void()>>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)();
+ }
+#else
+ for(vector<Test::AMD_TestIntf_startDispatchPtr>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)->ice_response();
+ }
+#endif
current.adapter->getCommunicator()->shutdown();
}
bool
+TestIntfI::supportsAMD(const Ice::Current&)
+{
+ return true;
+}
+
+bool
TestIntfI::supportsFunctionalTests(const Ice::Current&)
{
return false;
@@ -132,4 +188,3 @@ TestIntfControllerI::resumeAdapter(const Ice::Current&)
TestIntfControllerI::TestIntfControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter)
{
}
-
diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h
index edde85f6008..c839cafb551 100644
--- a/cpp/test/Ice/ami/TestI.h
+++ b/cpp/test/Ice/ami/TestI.h
@@ -34,20 +34,32 @@ public:
virtual bool waitForBatch(Ice::Int, const Ice::Current&);
virtual void close(Test::CloseMode, const Ice::Current&);
virtual void sleep(Ice::Int, const Ice::Current&);
+#ifdef ICE_CPP11_MAPPING
+ virtual void startDispatchAsync(std::function<void()>, std::function<void(std::exception_ptr)>,
+ const Ice::Current&);
+#else
+ virtual void startDispatch_async(const Test::AMD_TestIntf_startDispatchPtr&, const Ice::Current&);
+#endif
+ virtual void finishDispatch(const Ice::Current&);
virtual void shutdown(const Ice::Current&);
+ virtual bool supportsAMD(const Ice::Current&);
virtual bool supportsFunctionalTests(const Ice::Current&);
private:
int _batchCount;
+#ifdef ICE_CPP11_MAPPING
+ std::vector<std::function<void()>> _pending;
+#else
+ std::vector<Test::AMD_TestIntf_startDispatchPtr> _pending;
+#endif
};
class TestIntfControllerI : public Test::TestIntfController, IceUtil::Monitor<IceUtil::Mutex>
{
public:
-
virtual void holdAdapter(const Ice::Current&);
virtual void resumeAdapter(const Ice::Current&);
diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp
index 5654d66ec02..7d5854eead8 100644
--- a/cpp/test/Ice/background/AllTests.cpp
+++ b/cpp/test/Ice/background/AllTests.cpp
@@ -379,7 +379,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
#ifdef ICE_CPP11_MAPPING
background->opAsync();
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
background->opAsync();
vector<future<void>> results;
@@ -407,7 +407,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
#else
background->begin_op();
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
background->begin_op();
vector<Ice::AsyncResultPtr> results;
@@ -452,7 +452,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr
{
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
int i;
for(i = 0; i < 4; ++i)
@@ -560,7 +560,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr
}
configuration->connectException(new Ice::SocketException(__FILE__, __LINE__));
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
configuration->connectException(0);
try
@@ -592,7 +592,7 @@ initializeTests(const ConfigurationPtr& configuration,
{
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
int i;
for(i = 0; i < 4; i++)
@@ -682,7 +682,7 @@ initializeTests(const ConfigurationPtr& configuration,
cerr << ex << endl;
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -695,7 +695,7 @@ initializeTests(const ConfigurationPtr& configuration,
cerr << ex << endl;
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
#endif
//
@@ -728,7 +728,7 @@ initializeTests(const ConfigurationPtr& configuration,
{
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -764,7 +764,7 @@ initializeTests(const ConfigurationPtr& configuration,
}
configuration->initializeException(new Ice::SocketException(__FILE__, __LINE__));
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
configuration->initializeException(0);
try
@@ -784,12 +784,12 @@ initializeTests(const ConfigurationPtr& configuration,
}
configuration->initializeSocketOperation(IceInternal::SocketOperationWrite);
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
background->ice_ping();
configuration->initializeSocketOperation(IceInternal::SocketOperationNone);
ctl->initializeException(true);
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
ctl->initializeException(false);
try
@@ -812,11 +812,11 @@ initializeTests(const ConfigurationPtr& configuration,
{
#if !defined(ICE_USE_IOCP) && !defined(ICE_USE_CFSTREAM)
ctl->initializeSocketOperation(IceInternal::SocketOperationWrite);
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
background->op();
ctl->initializeSocketOperation(IceInternal::SocketOperationNone);
#else
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
background->op();
#endif
}
@@ -847,7 +847,7 @@ validationTests(const ConfigurationPtr& configuration,
{
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -921,7 +921,7 @@ validationTests(const ConfigurationPtr& configuration,
cerr << ex << endl;
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -1081,7 +1081,7 @@ validationTests(const ConfigurationPtr& configuration,
cerr << ex << endl;
test(false);
}
- background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -1163,7 +1163,7 @@ validationTests(const ConfigurationPtr& configuration,
#else
backgroundBatchOneway->begin_ice_flushBatchRequests();
#endif
- backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
ctl->holdAdapter();
backgroundBatchOneway->opWithPayload(seq);
@@ -1183,10 +1183,10 @@ validationTests(const ConfigurationPtr& configuration,
// in the flush to report a CloseConnectionException). Instead we
// wait for the first flush to complete.
//
- //backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ //backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
backgroundBatchOneway->end_ice_flushBatchRequests(r);
#endif
- backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
void
@@ -1775,10 +1775,10 @@ readWriteTests(const ConfigurationPtr& configuration,
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
background->ice_ping();
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
- background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ background->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
}
thread1->destroy();
diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp
index 511d186a205..4a07f3675d3 100644
--- a/cpp/test/Ice/binding/AllTests.cpp
+++ b/cpp/test/Ice/binding/AllTests.cpp
@@ -170,7 +170,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(test2->ice_getConnection() == test3->ice_getConnection());
names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
//
@@ -192,7 +192,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(vector<RemoteObjectAdapterPrxPtr>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
{
- (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ (*q)->getTestIntf()->ice_getConnection()->close(
+ Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
}
@@ -217,7 +218,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(test2->ice_getConnection() == test3->ice_getConnection());
names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
//
@@ -314,7 +315,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
try
{
- (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ (*q)->getTestIntf()->ice_getConnection()->close(
+ Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
catch(const Ice::LocalException&)
{
@@ -354,7 +356,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(test2->ice_getConnection() == test3->ice_getConnection());
names.erase(getAdapterNameWithAMI(test1));
- test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
//
@@ -376,7 +378,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(vector<RemoteObjectAdapterPrxPtr>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
{
- (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ (*q)->getTestIntf()->ice_getConnection()->close(
+ Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
}
@@ -401,7 +404,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(test2->ice_getConnection() == test3->ice_getConnection());
names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
//
@@ -433,7 +436,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
while(!names.empty())
{
names.erase(test->getAdapterName());
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)));
@@ -445,7 +448,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
while(!names.empty())
{
names.erase(test->getAdapterName());
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
deactivate(com, adapters);
@@ -473,7 +476,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter31"; i++);
}
#endif
@@ -483,7 +486,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter32"; i++);
}
#endif
@@ -493,7 +496,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter33"; i++);
}
#endif
@@ -525,29 +528,29 @@ allTests(const Ice::CommunicatorPtr& communicator)
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter36"; i++);
}
#endif
test(i == nRetry);
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
adapters.push_back(com->createObjectAdapter("Adapter35", endpoints[1]->toString()));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++);
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++);
}
#endif
test(i == nRetry);
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
adapters.push_back(com->createObjectAdapter("Adapter34", endpoints[0]->toString()));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++);
#if TARGET_OS_IPHONE > 0
if(i != nRetry)
{
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++);
}
#endif
@@ -865,7 +868,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(i = 0; i < 5; i++)
{
test(test->getAdapterName() == "Adapter82");
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
TestIntfPrxPtr testSecure = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_secure(true));
@@ -881,7 +884,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(i = 0; i < 5; i++)
{
test(test->getAdapterName() == "Adapter81");
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
com->createObjectAdapter("Adapter83", (test->ice_getEndpoints()[1])->toString()); // Reactive tcp OA.
@@ -889,7 +892,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(i = 0; i < 5; i++)
{
test(test->getAdapterName() == "Adapter83");
- test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
com->deactivateObjectAdapter(adapters[0]);
@@ -1098,7 +1101,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
// Close the connection now to free a FD (it could be done after the sleep but
// there could be race condiutation since the connection might not be closed
// immediately due to threading).
- test->ice_connectionId("0")->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ test->ice_connectionId("0")->ice_getConnection()->close(
+ Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
//
// The server closed the acceptor, wait one second and retry after freeing a FD.
diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp
index 36e65746c86..72275674797 100644
--- a/cpp/test/Ice/hold/AllTests.cpp
+++ b/cpp/test/Ice/hold/AllTests.cpp
@@ -290,7 +290,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
completed->get_future().get();
holdSerialized->ice_ping(); // Ensure everything's dispatched
- holdSerialized->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ holdSerialized->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
}
completed->get_future().get();
@@ -305,7 +305,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
result->waitForSent();
holdSerialized->ice_ping(); // Ensure everything's dispatched
- holdSerialized->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ holdSerialized->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
}
result->waitForCompleted();
diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp
index f87e2c32d0e..5145a13a7e9 100644
--- a/cpp/test/Ice/location/AllTests.cpp
+++ b/cpp/test/Ice/location/AllTests.cpp
@@ -637,7 +637,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
cout << "testing object migration... " << flush;
hello = ICE_CHECKED_CAST(HelloPrx, communicator->stringToProxy("hello"));
obj->migrateHello();
- hello->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ hello->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
hello->sayHello();
obj->migrateHello();
hello->sayHello();
diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp
index d5933489ea8..fbd29160cd4 100644
--- a/cpp/test/Ice/metrics/AllTests.cpp
+++ b/cpp/test/Ice/metrics/AllTests.cpp
@@ -287,7 +287,7 @@ struct Connect
{
if(proxy->ice_getCachedConnection())
{
- proxy->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ proxy->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
try
{
@@ -298,7 +298,7 @@ struct Connect
}
if(proxy->ice_getCachedConnection())
{
- proxy->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ proxy->ice_getCachedConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
}
@@ -534,8 +534,9 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
if(!collocated)
{
- metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
- metrics->ice_connectionId("Con1")->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ metrics->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
+ metrics->ice_connectionId("Con1")->ice_getConnection()->close(
+ Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
waitForCurrent(clientMetrics, "View", "Connection", 0);
waitForCurrent(serverMetrics, "View", "Connection", 0);
@@ -645,7 +646,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]);
test(map["holding"]->current == 1);
- metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ metrics->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
test(map["closing"]->current == 1);
@@ -660,7 +661,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none";
updateProps(clientProps, serverProps, update.get(), props, "Connection");
- metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ metrics->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
metrics->ice_timeout(500)->ice_ping();
controller->hold();
@@ -717,7 +718,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastHost", "");
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastPort", "");
- m->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ m->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
waitForCurrent(clientMetrics, "View", "Connection", 0);
waitForCurrent(serverMetrics, "View", "Connection", 0);
@@ -736,7 +737,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
test(m1->current == 0 && m1->total == 1 && m1->id == hostAndPort);
- metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ metrics->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
controller->hold();
try
{
@@ -788,7 +789,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
try
{
prx->ice_ping();
- prx->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ prx->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
}
catch(const Ice::LocalException&)
{
diff --git a/cpp/test/Ice/metrics/TestAMDI.cpp b/cpp/test/Ice/metrics/TestAMDI.cpp
index 37c8b310e0a..57ae9e1fb2e 100644
--- a/cpp/test/Ice/metrics/TestAMDI.cpp
+++ b/cpp/test/Ice/metrics/TestAMDI.cpp
@@ -22,7 +22,7 @@ MetricsI::opAsync(function<void()> response, function<void(exception_ptr)>, cons
void
MetricsI::failAsync(function<void()> response, function<void(exception_ptr)>, const Ice::Current& current)
{
- current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ current.con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
response();
}
@@ -87,7 +87,7 @@ MetricsI::op_async(const Test::AMD_Metrics_opPtr& cb, const Ice::Current&)
void
MetricsI::fail_async(const Test::AMD_Metrics_failPtr& cb, const Ice::Current& current)
{
- current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ current.con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
cb->ice_response();
}
diff --git a/cpp/test/Ice/metrics/TestI.cpp b/cpp/test/Ice/metrics/TestI.cpp
index 739fc99d4ae..4d6102c03e1 100644
--- a/cpp/test/Ice/metrics/TestI.cpp
+++ b/cpp/test/Ice/metrics/TestI.cpp
@@ -18,7 +18,7 @@ MetricsI::op(const Ice::Current&)
void
MetricsI::fail(const Ice::Current& current)
{
- current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ current.con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
}
void
diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp
index 47bcf2e87c0..2967a28e098 100644
--- a/cpp/test/Ice/operations/BatchOneways.cpp
+++ b/cpp/test/Ice/operations/BatchOneways.cpp
@@ -126,7 +126,7 @@ batchOneways(const Test::MyClassPrxPtr& p)
batch1->ice_ping();
batch2->ice_ping();
batch1->ice_flushBatchRequests();
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->ice_ping();
batch2->ice_ping();
@@ -134,7 +134,7 @@ batchOneways(const Test::MyClassPrxPtr& p)
batch2->ice_getConnection();
batch1->ice_ping();
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->ice_ping();
batch2->ice_ping();
}
diff --git a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp
index 92984de8b33..9fab4caae79 100644
--- a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp
+++ b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp
@@ -127,7 +127,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p)
batch1->ice_pingAsync().get();
batch2->ice_pingAsync().get();
batch1->ice_flushBatchRequestsAsync().get();
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->ice_pingAsync().get();
batch2->ice_pingAsync().get();
@@ -135,7 +135,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p)
batch2->ice_getConnection();
batch1->ice_pingAsync().get();
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->ice_pingAsync().get();
batch2->ice_pingAsync().get();
@@ -182,7 +182,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p)
batch1->end_ice_ping(batch1->begin_ice_ping());
batch2->end_ice_ping(batch2->begin_ice_ping());
batch1->end_ice_flushBatchRequests(batch1->begin_ice_flushBatchRequests());
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->end_ice_ping(batch1->begin_ice_ping());
batch2->end_ice_ping(batch2->begin_ice_ping());
@@ -190,7 +190,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p)
batch2->ice_getConnection();
batch1->end_ice_ping(batch1->begin_ice_ping());
- batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ batch1->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
batch1->end_ice_ping(batch1->begin_ice_ping());
batch2->end_ice_ping(batch2->begin_ice_ping());
diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp
index 24a8d60cc6a..1b35edb81cd 100644
--- a/cpp/test/Ice/retry/TestI.cpp
+++ b/cpp/test/Ice/retry/TestI.cpp
@@ -22,7 +22,7 @@ RetryI::op(bool kill, const Ice::Current& current)
{
if(current.con)
{
- current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully));
+ current.con->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
}
else
{
diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp
index 4c297bfe755..3ce32a52b99 100644
--- a/cpp/test/Ice/timeout/AllTests.cpp
+++ b/cpp/test/Ice/timeout/AllTests.cpp
@@ -294,7 +294,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
TimeoutPrxPtr to = ICE_CHECKED_CAST(TimeoutPrx, obj->ice_timeout(250));
Ice::ConnectionPtr connection = to->ice_getConnection();
timeout->holdAdapter(600);
- connection->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ connection->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
connection->getInfo(); // getInfo() doesn't throw in the closing state.
diff --git a/cpp/test/Ice/udp/AllTests.cpp b/cpp/test/Ice/udp/AllTests.cpp
index c72145cfd89..c02c0d4d5f4 100644
--- a/cpp/test/Ice/udp/AllTests.cpp
+++ b/cpp/test/Ice/udp/AllTests.cpp
@@ -116,7 +116,7 @@ allTests(const CommunicatorPtr& communicator)
{
test(seq.size() > 16384);
}
- obj->ice_getConnection()->close(ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ obj->ice_getConnection()->close(ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
communicator->getProperties()->setProperty("Ice.UDP.SndSize", "64000");
seq.resize(50000);
try
diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp
index 6d4147ea6e9..c776202b261 100644
--- a/cpp/test/IceSSL/configuration/AllTests.cpp
+++ b/cpp/test/IceSSL/configuration/AllTests.cpp
@@ -1585,7 +1585,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12)
//
verifier->reset();
verifier->returnValue(false);
- server->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait));
+ server->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
server->ice_ping();
diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp
index 4722fe93caf..4a76a18e441 100644
--- a/cpp/test/IceStorm/stress/Subscriber.cpp
+++ b/cpp/test/IceStorm/stress/Subscriber.cpp
@@ -163,7 +163,7 @@ public:
if(!_done && (IceUtilInternal::random(10) == 1 || ++_count == _total))
{
_done = true;
- current.con->close(CloseForcefully);
+ current.con->close(ICE_SCOPED_ENUM(ConnectionClose, Forcefully));
// Deactivate the OA. This ensures that the subscribers
// that have subscribed with oneway QoS will be booted.
current.adapter->deactivate();