summaryrefslogtreecommitdiff
path: root/cpp/test/uwp/controller/ViewController.xaml.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-05-25 12:48:24 +0200
committerJose <jose@zeroc.com>2017-05-25 12:48:24 +0200
commit04fff25f717295c00d9cef4e52158109a8e63549 (patch)
tree047bf0f3cf04736e82c58b20316830fc232552e6 /cpp/test/uwp/controller/ViewController.xaml.cpp
parentICE-7914 - remove use of _AUX functions for OpenSSL certificates (diff)
downloadice-04fff25f717295c00d9cef4e52158109a8e63549.tar.bz2
ice-04fff25f717295c00d9cef4e52158109a8e63549.tar.xz
ice-04fff25f717295c00d9cef4e52158109a8e63549.zip
Fix (ICE-7915) - Fix UWP/JS controllers to setup the bidir connection before register
Diffstat (limited to 'cpp/test/uwp/controller/ViewController.xaml.cpp')
-rw-r--r--cpp/test/uwp/controller/ViewController.xaml.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/cpp/test/uwp/controller/ViewController.xaml.cpp b/cpp/test/uwp/controller/ViewController.xaml.cpp
index 1ef4f5797f1..da938e00798 100644
--- a/cpp/test/uwp/controller/ViewController.xaml.cpp
+++ b/cpp/test/uwp/controller/ViewController.xaml.cpp
@@ -346,6 +346,7 @@ ControllerHelper::ControllerHelper(ViewController^ controller)
initData.properties = Ice::createProperties();
initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "10");
initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
+ initData.properties->setProperty("Ice.Override.ConnectTimeout", "1000");
//initData.properties->setProperty("Ice.Trace.Network", "3");
//initData.properties->setProperty("Ice.Trace.Protocol", "1");
initData.properties->setProperty("ControllerAdapter.AdapterId", Ice::generateUUID());
@@ -369,18 +370,33 @@ ControllerHelper::registerProcessController(ViewController^ controller,
const shared_ptr<ProcessControllerRegistryPrx>& registry,
const shared_ptr<ProcessControllerPrx>& processController)
{
- registry->setProcessControllerAsync(processController,
+ registry->ice_pingAsync(
[this, controller, adapter, registry, processController]()
{
auto connection = registry->ice_getCachedConnection();
connection->setAdapter(adapter);
connection->setACM(5, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways);
connection->setCloseCallback([=](const shared_ptr<Ice::Connection>&)
- {
- controller->println("connection with process controller registry closed");
- std::this_thread::sleep_for(2s);
- registerProcessController(controller, adapter, registry, processController);
- });
+ {
+ controller->println("connection with process controller registry closed");
+ std::this_thread::sleep_for(2s);
+ registerProcessController(controller, adapter, registry, processController);
+ });
+
+ registry->setProcessControllerAsync(processController, nullptr,
+ [controller](exception_ptr e)
+ {
+ try
+ {
+ rethrow_exception(e);
+ }
+ catch(const std::exception& ex)
+ {
+ ostringstream os;
+ os << "unexpected exception while connecting to process controller registry:\n" << ex.what();
+ controller->println(os.str());
+ }
+ });
},
[this, controller, adapter, registry, processController](exception_ptr e)
{