summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/udp/Client.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2015-12-11 18:00:31 -0500
committerBernard Normier <bernard@zeroc.com>2015-12-11 18:00:31 -0500
commita2dfe3a7cd457d0d4b38399ab0aca4f0335fb0c8 (patch)
tree979e304b6beb03bdceed36bee74edd5cabfa9add /cpp/test/Ice/udp/Client.cpp
parentFix Windows C++ tests build (diff)
downloadice-a2dfe3a7cd457d0d4b38399ab0aca4f0335fb0c8.tar.bz2
ice-a2dfe3a7cd457d0d4b38399ab0aca4f0335fb0c8.tar.xz
ice-a2dfe3a7cd457d0d4b38399ab0aca4f0335fb0c8.zip
Updated Ice::CommunicationHolder and simplified tests
Diffstat (limited to 'cpp/test/Ice/udp/Client.cpp')
-rw-r--r--cpp/test/Ice/udp/Client.cpp42
1 files changed, 12 insertions, 30 deletions
diff --git a/cpp/test/Ice/udp/Client.cpp b/cpp/test/Ice/udp/Client.cpp
index 40e8ed779af..07d1ae2a74f 100644
--- a/cpp/test/Ice/udp/Client.cpp
+++ b/cpp/test/Ice/udp/Client.cpp
@@ -39,47 +39,29 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- int status;
- Ice::CommunicatorPtr communicator;
-
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
-
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.UDP.RcvSize", "16384");
initData.properties->setProperty("Ice.UDP.SndSize", "16384");
- communicator = ICE_COMMUNICATOR_HOLDER_RELEASE(Ice::initialize(argc, argv, initData));
- status = run(argc, argv, communicator);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
+ int status = run(argc, argv, ich.communicator());
+
+#if TARGET_OS_IPHONE != 0
+ //
+ // iOS WORKAROUND: without a sleep before the communicator
+ // destroy, the close on the UDP socket hangs.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+#endif
+ return status;
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
- status = EXIT_FAILURE;
- }
-
- if(communicator)
- {
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ return EXIT_FAILURE;
}
-
-#if TARGET_OS_IPHONE != 0
- //
- // iOS WORKAROUND: without a sleep before the communicator
- // destroy, the close on the UDP socket hangs.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
-#endif
-
- return status;
}